aroundLatLng OR faceted?

I have a series of providers in my index:

  • some are local (they have specific lat/lng in their _geoloc attribute)
  • some are state wide providers (they have a “state” attibute with the list of states they service, e.g. [“NY”, “FL”])
  • some are national providers (they have a national: true attribute)

I want in my results anything that matches local providers by location close to my users, but also provide in the same results state and national providers. Adding a aroundLatLng filter automatically removes other results, no matter what facets or filters I try.

How can I achieve this?

Basically I want to have something like: aroundLatLng: x,y OR state: NY OR national: true

How hard would it be to inject a “state” geocode for the statewide providers using canonical lat/long values like these from Google? You can have multiple geocodes for each state they service (Geo Location | Managing Results | Guide | Algolia Documentation).

That way your geosearch can cover both. You can control which are considered more relevant using a custom ranking on the state attribute.

For the national carriers, you can inject them with a rule based on the national: true attribute.
If you want to maintain a particular order, you could then add a custom ranking criteria to put

@chuck.meyer that’s an interesting proposal, I’ll be testing it. Thank you!