RediSearch icon indicating copy to clipboard operation
RediSearch copied to clipboard

[BUG] getting incorrect result with multiple geospatial conditions in query

Open atakavci opened this issue 8 months ago • 2 comments

Describe the bug getting no result when introduce multiple geospatial conditions (like this one "@geofield:[DISJOINT $geospatials0] @geofield2:[INTERSECTS $geospatials1]") into a single query where there are keys that satisfies all conditions.

To Reproduce

"FT.CREATE" "idx" "SCHEMA" "geofield" "GEOSHAPE" "FLAT" "geofield2" "GEOSHAPE" "FLAT"
"HSET" "doc1" "geofield" "POINT (10  10)" "geofield2" "POLYGON ((20 20, 25 35, 35 25, 20 20))"
"HSET" "doc2" "geofield" "POINT (50  50)" "geofield2" "POLYGON ((60 60, 65 75, 70 70, 65 55, 60 60))"
"FT.SEARCH" "idx" "@geofield:[DISJOINT $geospatials0] @geofield2:[INTERSECTS $geospatials1]" "PARAMS" "4" "geospatials0" "POLYGON ((15 15, 75 15, 50 70, 20 40, 15 15))" "geospatials1" "POLYGON ((15 15, 75 15, 50 70, 20 40, 15 15))" "DIALECT" "3"

steps above contains 5 geoshapes

    point1 = Point(10, 10);
    point2 = Point(50, 50);
    polygon1 = Polygon((20, 20), (25, 35), (35, 25), (20, 20));
    polygon2 = Polygon((60, 60), (65, 75), (70, 70), (65, 55), (60, 60));
    queryPolygon = Polygon((15, 15), (75, 15), (50, 70), (20, 40), (15, 15));

queryPolygon contains point2 and polygon1 queryPolygon disjoints point1 and polygon2

Expected behavior I am not sure if 'AND' is in the scope of geosearch with polygons, but i expect it to return doc1 or at least fail to execute with a parsing error.

Screenshots

Environment (please complete the following information):

  • OS: [ubuntu 24.04]
  • CPU model [ i7-1270P ]
  • Version/branch [master]

Additional context It returns when used with 'OR' | operator

"FT.SEARCH" "idx" "@geofield:[DISJOINT $geospatials0] | @geofield2:[INTERSECTS $geospatials1]" "PARAMS" "4" "geospatials0" "POLYGON ((15 15, 75 15, 50 70, 20 40, 15 15))" "geospatials1" "POLYGON ((15 15, 75 15, 50 70, 20 40, 15 15))" "DIALECT" "3"

atakavci avatar Jun 12 '24 10:06 atakavci