]> git.openstreetmap.org Git - nominatim.git/commitdiff
link nodes and relations using name->'name' index lookup instead of search_name
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Thu, 26 Apr 2012 12:01:26 +0000 (13:01 +0100)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Thu, 26 Apr 2012 12:01:26 +0000 (13:01 +0100)
sql/functions.sql
sql/indices.src.sql

index b248a46d104601337458832a17e35e20845dd702..3c9da6a5defac4b57334764e7149100de0552a4e 100644 (file)
@@ -1532,14 +1532,14 @@ BEGIN
 
       -- not found one yet? how about doing a name search
       IF NEW.centroid IS NULL THEN
-        FOR linkedPlacex IN select placex.* from search_name join placex using (place_id) WHERE
-          search_name.name_vector @> ARRAY[getorcreate_name_id(make_standard_name(NEW.name->'name'))] 
-          AND search_name.search_rank = NEW.rank_search
-          AND search_name.place_id != NEW.place_id
+        FOR linkedPlacex IN select placex.* from placex WHERE
+          make_standard_name(name->'name') = make_standard_name(NEW.name->'name')
+          AND placex.rank_search = NEW.rank_search
+          AND placex.place_id != NEW.place_id
           AND osm_type = 'N'
-          AND NEW.name->'name' = placex.name->'name'
           AND st_contains(NEW.geometry, placex.geometry)
         LOOP
+
           -- If we don't already have one use this as the centre point of the geometry
           IF NEW.centroid IS NULL THEN
             NEW.centroid := coalesce(linkedPlacex.centroid,st_centroid(linkedPlacex.geometry));
index 05cbd90d556045fcb9cedb4ced8101961304418c..57a6cdd749d3330e04761cf70f82eb3fb8b0f583 100644 (file)
@@ -15,7 +15,7 @@ CREATE INDEX idx_placex_pendingsector ON placex USING BTREE (rank_search,geometr
 CREATE INDEX idx_placex_parent_place_id ON placex USING BTREE (parent_place_id) where parent_place_id IS NOT NULL;
 CREATE INDEX idx_placex_interpolation ON placex USING BTREE (geometry_sector) where indexed_status > 0 and class='place' and type='houses';
 CREATE INDEX idx_placex_sector ON placex USING BTREE (geometry_sector,rank_address,osm_type,osm_id);
-
+CREATE INDEX idx_placex_adminname on placex USING BTREE (make_standard_name(name->'name'),rank_search) WHERE osm_type='N' and rank_search < 26;
 CREATE INDEX idx_location_area_country_place_id ON location_area_country USING BTREE (place_id);
 
 CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid);