]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 26 May 2014 20:24:54 +0000 (22:24 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 26 May 2014 20:24:54 +0000 (22:24 +0200)
1  2 
lib/lib.php
sql/functions.sql

diff --combined lib/lib.php
index b26038d8f2bcbd317875cabd01897287c0c08145,1e05def37c3ce833e39190b252ff3278a0030c55..b54023a4becbc1bde9ee7322130c26381024204b
@@@ -45,7 -45,7 +45,7 @@@
                if (!$sUserError) $sUserError = $sError;
                error_log('ERROR: '.$sError);
                echo $sUserError."\n";
-               exit;
+               exit(-1);
        }
  
  
@@@ -94,8 -94,7 +94,8 @@@
  
        function bySearchRank($a, $b)
        {
 -              if ($a['iSearchRank'] == $b['iSearchRank']) return 0;
 +              if ($a['iSearchRank'] == $b['iSearchRank'])
 +            return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
                return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
        }
  
        {
                $aResult = array(array(join(' ',$aWords)));
                $sFirstToken = '';
 -              if ($iDepth < 8) {
 +              if ($iDepth < 7) {
                        while(sizeof($aWords) > 1)
                        {
                                $sWord = array_shift($aWords);
diff --combined sql/functions.sql
index a6fa20ea295be751f907848f663149d4b1e2b3ca,e0f6de72f6382aaf410bffb7796db8432723b021..488d340f09958250ab1f5ff0d725896bacc5dc5a
@@@ -936,11 -936,6 +936,11 @@@ DECLAR
  BEGIN
    --DEBUG: RAISE WARNING '% %',NEW.osm_type,NEW.osm_id;
  
 +  -- remove operator tag for most places, messes too much with search_name indexes
 +  IF NEW.class not in ('amenity', 'shop') THEN
 +    NEW.name := delete(NEW.name, 'operator');
 +  END IF;
 +
    -- just block these
    IF NEW.class in ('landuse','natural') and NEW.name is null THEN
  --    RAISE WARNING 'empty landuse %',NEW.osm_id;
@@@ -2064,11 -2059,6 +2064,11 @@@ BEGI
      --DEBUG: RAISE WARNING '%', existingplacex;
    END IF;
  
 +  -- remove operator tag for most places, messes too much with search_name indexes
 +  IF NEW.class not in ('amenity', 'shop') THEN
 +    NEW.name := delete(NEW.name, 'operator');
 +  END IF;
 +
    -- Just block these - lots and pointless
    IF NEW.class in ('landuse','natural') and NEW.name is null THEN
      -- if the name tag was removed, older versions might still be lurking in the place table
  
    END IF;
  
 +  -- refuse to update multiplpoygons with too many objects, too much of a performance hit
 +  IF ST_NumGeometries(NEW.geometry) > 2000 THEN
 +    RAISE WARNING 'Dropping update of % % because of geometry complexity.', NEW.osm_type, NEW.osm_id;
 +    RETURN NULL;
 +  END IF;
 +
    IF coalesce(existing.name::text, '') != coalesce(NEW.name::text, '')
       OR coalesce(existing.extratags::text, '') != coalesce(NEW.extratags::text, '')
       OR coalesce(existing.housenumber, '') != coalesce(NEW.housenumber, '')
@@@ -2503,7 -2487,7 +2503,7 @@@ BEGI
        CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
        class, type, admin_level, true as fromarea, true as isaddress,
        CASE WHEN rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
-       0 as distance, calculated_country_code
+       0 as distance, calculated_country_code, postcode
        from placex
        where place_id = for_place_id 
    LOOP
      IF searchpostcode IS NOT NULL and location.type = 'postcode' THEN
        location.isaddress := FALSE;
      END IF;
+     IF searchpostcode IS NULL and location.postcode IS NOT NULL THEN
+       searchpostcode := location.postcode;
+     END IF;
      IF location.rank_address = 4 AND location.isaddress THEN
        hadcountry := true;
      END IF;