]> git.openstreetmap.org Git - nominatim.git/commitdiff
avoid contains operator for geometries
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 2 Dec 2020 21:18:27 +0000 (22:18 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 2 Dec 2020 21:18:27 +0000 (22:18 +0100)
Postgis keeps messing up use of index in some circumstances.

sql/functions/placex_triggers.sql

index ea9474e4bb469546045d9ea716ccda6241518c83..87f15e8c59954f7ab97ec31594f1f8525692a10d 100644 (file)
@@ -97,7 +97,7 @@ BEGIN
         -- Instead simply use the containing area with the largest rank.
         FOR location IN
           SELECT place_id FROM placex
-            WHERE bbox @ geometry AND _ST_Covers(geometry, ST_Centroid(bbox))
+            WHERE bbox && geometry AND _ST_Covers(geometry, ST_Centroid(bbox))
                   AND rank_address between 5 and 25
             ORDER BY rank_address desc
         LOOP
@@ -112,7 +112,7 @@ BEGIN
         -- contains the bbox, only use addressable features
         FOR location IN
           SELECT place_id FROM placex
-            WHERE bbox @ geometry AND _ST_Covers(geometry, ST_Centroid(bbox))
+            WHERE bbox && geometry AND _ST_Covers(geometry, ST_Centroid(bbox))
                   AND rank_address between 5 and 25
             ORDER BY rank_address desc
         LOOP