Filtering by address, city or country

Using a geographic search input allows users to search by address or by city (London, UK) or by country (United Kingdom). When using this as a filter I’ve got it set up paired with a distance input so it searches, e.g. any result within 5 miles of London. When the user searches by country, however, it doesn’t show up with any results. I’m assuming this is because it takes a central point for the country in the middle of nowhere.

Goal is for it to show results for everyone whose country is the United Kingdom. Currently looking at hacky ways of having different filters depending on whether the extracted address’ city is empty or not, though wondering if anyone can save me some time and knows a simpler way?

1 Like

have the same problem, did you find a workaround? if yes, could you please share it with me

Had same problem. Only easy way to solve it is to extract country, from address in the moment of creation of this record and then filtering the database on this field.

I am using the range filter - as I need to filter countries within UK, so I found a point that creates a radaius field that contains all UK Addresses, but that is just a workaround working in specific cases (islands).

Hi there! Had the same issue; I also found that the only easy workaround is to use filters and conditional states - otherwise you have to use a plugin or make direct API calls for the geocoding and maps APIs.
I recorded a quick tutorial on how to set up the filters if it helps out people who might have the same problem :slight_smile:

1 Like

I got to the same conclusion. Having to add an extra conditional also as some people are searching for Northern Ireland, England, Scotland, etc. Great video, thanks!