insidePolygon and facetFilters

Hi, to all.

We using Algolia for real estate search platform, looks like this service:
https://www.compass.com/search/nyc/

The problem We facing now is combination of neighborhoods and polygons.
Filtering apartment by neighborhoodName works just fine:

let query = {
      facetFilters:["neighborhoodName:Soho"]
}

also filtering based on polygon works fine:

    let query = {
        insidePolygon: [40.88636097639207, -74.11284730082784, 40.88514132330036, -73.64903418333917,
            40.66952057348436, -73.77486869867764, 40.53300908952352, -74.13220645702775,
            40.88636097639207, -74.11284730082784]
    }

But if both properties is defined it works “AND”, and we absolutley understand the logic behind.
So my question is: is there any way to get results from neighborhoodName OR insidePolygon

So if user selects neighborhood SoHo in Manhattan and draws polygon somewhere in Brooklyn we will get results from both.

Thanks.

Hi @danielos,

It’s indeed not feasible to express “facet:value OR insidePolygon”, all our different filters are doing an AND by default between them.

For your usecase:

  • either when you draw the polygon, the user may want ONLY places inside that polygon and not the ones inside Soho too (that’s actually what most map based searches are doing, like AirBnB)
  • or you do two queries and then merge the results in a way

Let me know how it goes.