]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge branch 'tiger2014' of https://github.com/mtmail/Nominatim
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 8 May 2015 17:37:40 +0000 (19:37 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 8 May 2015 17:37:40 +0000 (19:37 +0200)
lib/Geocode.php
lib/db.php
lib/lib.php
sql/functions.sql
tests/features/db/import/search_terms.feature

index 212eebb97cc2a3b04f8a5369755fe6cc79163cc9..18062d8c8784d259824115382cbcf0c4ac3e2716 100644 (file)
                                if (isset($aClassType[$aResult['class'].':'.$aResult['type']]['importance'])
                                        && $aClassType[$aResult['class'].':'.$aResult['type']]['importance'])
                                {
-                                       $aResult['foundorder'] = $aResult['foundorder'] + 0.000001 * $aClassType[$aResult['class'].':'.$aResult['type']]['importance'];
+                                       $aResult['foundorder'] += 0.0001 * $aClassType[$aResult['class'].':'.$aResult['type']]['importance'];
                                }
                                else
                                {
-                                       $aResult['foundorder'] = $aResult['foundorder'] + 0.001;
+                                       $aResult['foundorder'] += 0.01;
                                }
                                $aSearchResults[$iResNum] = $aResult;
                        }
index b6dc89c49157ddd16072a829221f5d6193c9ef5b..d7c85e7b6df684f850c9e283bc3e2a29195689f9 100644 (file)
@@ -14,6 +14,8 @@
                $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
                $oDB->query("SET DateStyle TO 'sql,european'");
                $oDB->query("SET client_encoding TO 'utf-8'");
+               $iMaxExecution = ini_get('max_execution_time') * 1000;
+               if ($iMaxExecution > 0) $oDB->query("SET statement_timeout TO $iMaxExecution");
                return $oDB;
        }
 
index 2f94c25cf7c7d8eab011cdd46a6691954b77a933..c68f04eb9df20e05c13c0a9819cdb4a743148b75 100644 (file)
  'tourism:hotel' => array('label'=>'Hotel','frequency'=>2150,'icon'=>'accommodation_hotel2',),
  'tourism:motel' => array('label'=>'Motel','frequency'=>43,'icon'=>'',),
  'amenity:cinema' => array('label'=>'Cinema','frequency'=>277,'icon'=>'tourist_cinema',),
- 'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
  'tourism:artwork' => array('label'=>'Artwork','frequency'=>171,'icon'=>'tourist_art_gallery2',),
  'historic:archaeological_site' => array('label'=>'Archaeological Site','frequency'=>407,'icon'=>'tourist_archaeological2',),
  'amenity:doctors' => array('label'=>'Doctors','frequency'=>581,'icon'=>'health_doctors',),
  'shop:travel_agency' => array('label'=>'Travel Agency','frequency'=>21,'icon'=>'',),
  'shop:hifi' => array('label'=>'Hifi','frequency'=>21,'icon'=>'',),
  'amenity:shop' => array('label'=>'Shop','frequency'=>61,'icon'=>'',),
+ 'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
 
  'place:house' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
  'place:house_name' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
index 878c69c972746770d748750193224520a9f518e2..3c8f16e0831a5696d7974f48889183bc79b9fc10 100644 (file)
@@ -1403,6 +1403,26 @@ BEGIN
         select * from search_name where place_id = NEW.parent_place_id INTO location;
         NEW.calculated_country_code := location.country_code;
 
+        -- Merge the postcode into the parent's address if necessary XXXX
+        IF NEW.postcode IS NOT NULL THEN
+          isin_tokens := '{}'::int[];
+          address_street_word_id := getorcreate_word_id(make_standard_name(NEW.postcode));
+          IF address_street_word_id is not null
+             and not ARRAY[address_street_word_id] <@ location.nameaddress_vector THEN
+             isin_tokens := isin_tokens || address_street_word_id;
+          END IF;
+          address_street_word_id := getorcreate_name_id(make_standard_name(NEW.postcode));
+          IF address_street_word_id is not null
+             and not ARRAY[address_street_word_id] <@ location.nameaddress_vector THEN
+             isin_tokens := isin_tokens || address_street_word_id;
+          END IF;
+          IF isin_tokens != '{}'::int[] THEN
+             UPDATE search_name
+                SET nameaddress_vector = search_name.nameaddress_vector || isin_tokens
+              WHERE place_id = NEW.parent_place_id;
+          END IF;
+        END IF;
+
 --RAISE WARNING '%', NEW.name;
         -- If there is no name it isn't searchable, don't bother to create a search record
         IF NEW.name is NULL THEN
@@ -2245,7 +2265,6 @@ BEGIN
            housenumber, rank_search, postcode, null
       from placex where place_id = in_place_id
       INTO for_place_id, searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode, searchhousename;
-      RAISE WARNING '% fffff %', in_place_id, for_place_id;
   END IF;
 
 --RAISE WARNING '% % % %',searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode;
index 642b3ea8974f8d71aa42706d09faada5e79d2751..f68fe61ca70fc02b61f06eb3893418354e57d3e3 100644 (file)
@@ -26,3 +26,17 @@ Feature: Creation of search terms
         Then search_name table contains
          | place_id | name_vector | nameaddress_vector
          | N1       | foo         | the road
+
+    Scenario: Roads take over the postcode from attached houses
+        Given the scene roads-with-pois
+        And the place nodes
+         | osm_id | class | type  | housenumber | postcode | street   | geometry
+         | 1      | place | house | 1           | 12345    | North St |:p-S1
+        And the place ways
+         | osm_id | class   | type        | name     | geometry
+         | 1      | highway | residential | North St | :w-north
+        When importing
+        Then search_name table contains
+         | place_id | nameaddress_vector
+         | W1       | 12345
+