You can also try FilterGeoWithin
, It is mainly for multiple location search
const coordinates = [
{ lat: -28.281932, lon: -55.573635 },
{ lat: -31.254713, lon: -50.928666 },
{ lat: -16.181724, lon: -47.217881 }
];
query.getRequest().setSearchFilter(new FilterGeoWithin('location', '7km',coordinates));
Use FilterGeo
when: You need pinpoint accuracy or want to focus on a single point. This is ideal for searches that relate to a fixed point, like finding services or items closest to a user’s current location.
Use FilterGeoWithin
when: Your search criteria require covering an area rather than a point. This is great for regional promotions, events, or when you want to include multiple neighborhoods or parts of a city in your search scope.