]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/SearchDescription.php
Merge pull request #2076 from lonvia/search-name-index-migration
[nominatim.git] / lib / SearchDescription.php
index 94ba87ff76480e3e237010e0b7005f5fa835034b..1e1955c249a7e8a498a9c1d92d4bc08991fbf6b1 100644 (file)
@@ -248,6 +248,18 @@ class SearchDescription
                     $oSearch->iSearchRank++;
                 }
                 $aNewSearches[] = $oSearch;
+                // Housenumbers may appear in the name when the place has its own
+                // address terms.
+                if ($oSearchTerm->iId !== null
+                    && ($this->iNamePhrase >= 0 || empty($this->aName))
+                    && empty($this->aAddress)
+                   ) {
+                    $oSearch = clone $this;
+                    $oSearch->iSearchRank++;
+                    $oSearch->aAddress = $this->aName;
+                    $oSearch->aName = array($oSearchTerm->iId => $oSearchTerm->iId);
+                    $aNewSearches[] = $oSearch;
+                }
             }
         } elseif ($sPhraseType == ''
                   && is_a($oSearchTerm, '\Nominatim\Token\SpecialTerm')