mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add bbox whereclause to make postgis 3.0 happy
Normally ST_Covers() should include a bbox index use, so adding a bbox where clause is not really necessary. However, the query planner messes up and uses a parallel index search with a second index instead of exclusively running on the geometry index, when the bbox part is missing.
This commit is contained in:
@@ -579,7 +579,10 @@ BEGIN
|
|||||||
IF NEW.osm_type = 'N' AND addr_street IS NULL AND addr_place IS NULL
|
IF NEW.osm_type = 'N' AND addr_street IS NULL AND addr_place IS NULL
|
||||||
AND NEW.housenumber IS NULL THEN
|
AND NEW.housenumber IS NULL THEN
|
||||||
FOR location IN
|
FOR location IN
|
||||||
|
-- The additional && condition works around the misguided query
|
||||||
|
-- planner of postgis 3.0.
|
||||||
SELECT address from placex where ST_Covers(geometry, NEW.centroid)
|
SELECT address from placex where ST_Covers(geometry, NEW.centroid)
|
||||||
|
and geometry && NEW.centroid
|
||||||
and (address ? 'housenumber' or address ? 'street' or address ? 'place')
|
and (address ? 'housenumber' or address ? 'street' or address ? 'place')
|
||||||
and rank_search > 28 AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')
|
and rank_search > 28 AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')
|
||||||
limit 1
|
limit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user