Forum Academy Marketplace Showcase Pricing Features

How to filter search results by radius - doesn't work first try but works thereafter

Hello! I need help with controlling search results. I’m basically building a niche business listing application and would like it to do the following: User enters a search term in the input box, an address into a search box, and sets the radius slider. Upon clicking the ‘search’ icon, the app will then display a list of businesses that meet the criteria. They are also displayed as pins on a map.

Here’s a more detailed description of how I currently have set this up:
The search term is found in the input box
The location is found in a searchbox that is set to ‘geographic address’
the radius is the value of a slider input
The ‘button’ is actually a magnifying glass icon.
The search function is handled by Search&Autocorrect plugin
The results display is a repeating group

My workflow looks like this:
When the search icon is pressed, set custom state of the results display (repeating group) to be a list of Search&Autocorrect’s matches, and the data source for the results display is the custom state. I did this so the results won’t dynamically update as the user types in the input box. This way, the results stay there as the user types a new search and don’t update until the button is pressed.

There is a constraint set within the Search&Autocorrect element that says the Virtual Booth (type) 's Location (geographic address field of type Virtual Booth), must be within “radius’s value” of “address input’s” value (searchbox with geographic address input):

Here’s what happens:
Page is loaded - no problem.
Type “custom” into the input box, select “Golden, CO” in the location box, set radius at 20, click magnifying glass - nothing happens. Using the step-by-step tool shows that Search&Autocorrect pulled no matches.

-HOWEVER-

If I then erase one letter of my search and retyping it, so it’s the same (“custom”), and click the magnifying glass again, it pulls the correct results! Where have I gone wrong here? Any ideas why it doesn’t work the first time but works after that?

i am having the exact same issue and any insight as to resolve would be helpful.

The integration of a filtered repeating list, specific id from list, and responsive map would be an incredible tutorial by bubble.

1 Like

Welcome to the vast emptiness of this thread! Haha.

I never found a proper solution unfortunately and instead got rid of the search term box and just did location and category filters. Then my repeating group displays all of the listings, filtered by the constraints mentioned previously.

Cheers!