]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/SearchDescription.php
allow search for partials consisting of 3 or more words
[nominatim.git] / lib-php / SearchDescription.php
index a7b26c1281049e9b388640887ece1cce5d6db40b..3f3beab1964dd2e2578c117bac663ce9baa5535c 100644 (file)
@@ -264,6 +264,8 @@ class SearchDescription
     {
         if (empty($this->aName)) {
             $this->bNameNeedsAddress = $bNeedsAddress;
+        } elseif ($bSearchable && count($this->aName) >= 2) {
+            $this->bNameNeedsAddress = false;
         } else {
             $this->bNameNeedsAddress &= $bNeedsAddress;
         }
@@ -642,6 +644,7 @@ class SearchDescription
             // Housenumbers on streets and places.
             $sPlacexSql = 'SELECT array_agg(place_id) FROM placex';
             $sPlacexSql .= ' WHERE parent_place_id = sin.place_id AND sin.address_rank < 30';
+            $sPlacexSql .= $this->oContext->excludeSQL(' AND place_id');
             $sPlacexSql .= '       and housenumber ~* E'.$sHouseNumberRegex;
 
             // Interpolations on streets and places.
@@ -650,7 +653,8 @@ class SearchDescription
             if (preg_match('/^[0-9]+$/', $this->sHouseNumber)) {
                 $sIpolHnr = 'WHERE parent_place_id = sin.place_id ';
                 $sIpolHnr .= '  AND startnumber is not NULL AND sin.address_rank < 30';
-                $sIpolHnr .= '  AND '.$this->sHouseNumber.' between startnumber and endnumber ';
+                $sIpolHnr .= '  AND '.$this->sHouseNumber.' between startnumber and endnumber';
+                $sIpolHnr .= '  AND ('.$this->sHouseNumber.' - startnumber) % step = 0';
 
                 $sInterpolSql = 'SELECT array_agg(place_id) FROM location_property_osmline '.$sIpolHnr;
                 if (CONST_Use_US_Tiger_Data) {