]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #5 from mfn/improve_errmsg
authorBrian Quinion <github@brian.quinion.co.uk>
Thu, 26 Apr 2012 13:50:58 +0000 (06:50 -0700)
committerBrian Quinion <github@brian.quinion.co.uk>
Thu, 26 Apr 2012 13:50:58 +0000 (06:50 -0700)
Do not swallow PEAR error during setup in import-data.

sql/functions.sql
sql/indices.src.sql

index b248a46d104601337458832a17e35e20845dd702..806e1566f09fd1c9d26a2c755a4eab87d112e661 100644 (file)
@@ -1007,8 +1007,8 @@ BEGIN
         NEW.rank_search := 8;
         NEW.rank_address := NEW.rank_search;
       ELSEIF NEW.type in ('region') THEN
-        NEW.rank_search := 10;
-        NEW.rank_address := NEW.rank_search;
+        NEW.rank_search := 18; -- dropped from previous value of 10
+        NEW.rank_address := 0; -- So badly miss-used that better to just drop it!
       ELSEIF NEW.type in ('county') THEN
         NEW.rank_search := 12;
         NEW.rank_address := NEW.rank_search;
@@ -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);