How to use Prefer Results Around for Searchbox Geographic location element

The searchbox gographic location is working properly, and my APIs are set up correctly.

I’ve noticed that bubblers have set up this “prefer results around” setting to “Canada” or “United States”

How is this done? When I type in this box, nothing happens, and Bubble has no documentation on this.

5 Likes

Have you solved this one? I’m as well curious.

I don’t think it was solved

Just type in whatever you want in your ‘prefer results around’ box. Can be an actual address, a city, state or country.

Then a radius field appears and set your radius in metres.

Simple :slight_smile:

1 Like

Hi,

I am struggling with this “prefer results around” option…

I am trying to limit results to a specific country (France in my case) but when I enter “France” in “Prefer results around” no matter the value of the radius (I’ve tried different values including 0) I always get results from countries located thousands of miles/km from France including Canada, Vietnam etc.

Is that feature really working ? What am I doing wrong ? Does anyone know of a workaround to limit the searchbox results to a given country, region or city ?

It worked for me by entering a Post Code of some place in my city and it recognised and autocompleted the city and the country in the “Prefer results around” field

1 Like

I have the same issue, in my case limiting the search results to Switzerland. Is there anyone who can help with this?

Did anyone find a solution to this?
I’m typing in India and the results are still showing up from all over the world.

Doesn’t work and Bubble has not fixed it. I’m not sure if is entirely Bubble fault for not fixing it or if issue lies with Google.

I found a way for it to work.

Are you sure it works?

Yes sire!
Earlier when I searched, it showed results from all over the world. With these settings, it’s showing only for India.

1 Like

Good for you… or was it luck?
I’ve tried that for France using your 100m radius value…and many other values but got no difference at all >> still showing results from all around the world

Hi, did you actually manage to get it to work properly?
Apparently we’ve all tried that to no avail… would appreciate further details / specifics from your working use case to help us see the light :grin:

Just found how we can make this work!
First: The “Results around” only receives address, not text. Will not work if you put “Arbitrary text”, and put a static value like “10001 New York”.

What you have to do, instead is:

  1. Create one hided element, property or custom state with datatype = geo address.
  2. Manually populate your thing 1 with your static address (India, EUA, New York…)
  3. Use your thing 1 as “results around” in your main search for address
  4. Don’t forget to add a radius :sweat_smile:

Video summarizing everything

2 Likes

Thanks @caiokaspary ! This is what I was missing, you’ve made my day :grin:

I was typing or refering to a city / country name in [Prefer results around] field and it just didn’t seem to work… now I refer to a geographic-address-type custom state and it works like a charm!

I guess the documentation for this searchbox could be improved… or there could be a control that should prevent using anything else than a geographic address type in that field to avoid any misunderstanding.

Anyway, thanks for sharing!

cc @emmanuel @laura.oppenheimer

I’m speculating but you should also be able to specify a latitude and longitude. Bubble likely converts your entered location into a latitude and longitude to send the request. Again, worth a shot if anyone’s struggling. Nearby Search  |  Places API  |  Google for Developers

  • location

The point around which to retrieve place information. This must be specified as latitude,longitude.

  • radius

Defines the distance (in meters) within which to return place results. You may bias results to a specified circle by passing a location and a radius parameter. Doing so instructs the Places service to prefer showing results within that circle; results outside of the defined area may still be displayed.The radius will automatically be clamped to a maximum value depending on the type of search and other parameters.

  • Autocomplete: 50,000 meters
  • Nearby Search:
    • with keyword or name: 50,000 meters
    • without keyword or name
      • Up to 50,000 meters, adjusted dynamically based on area density, independent of rankby parameter.
      • When using rankby=distance, the radius parameter will not be accepted, and will result in an INVALID_REQUEST.
  • Query Autocomplete: 50,000 meters
  • Text Search: 50,000 meters

It doesn’t even let me type in something like United States or Canada in my case. Do you have to get this data dynamically?

**Whoops - It worked once I followed instructions from How to use Prefer Results Around for Searchbox Geographic location element - #15 by caiokaspary

I actually did this a bit differently by setting the state of the group I have the searchbox in and defaulting it to ‘United States’

I also set the radius to 100000. Not sure if that matters.

I should add, that it isn’t perfect. I still get non US locations, but at least it now prioritizes US ones.

Or you can add an OS (Geographic adress) :


And get an option :