]> git.openstreetmap.org Git - nominatim.git/commitdiff
always ignore multi term partials in search
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 23 May 2021 20:13:03 +0000 (22:13 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 23 May 2021 20:13:03 +0000 (22:13 +0200)
Partial terms should only ever consist of one word. Ignore
any other, they are a leftover from inefficient word index
builts.

lib-php/SearchDescription.php

index 189ffa74e99fbca744efc659f98f62426ca7afc2..8da49a9ff0bfc7d2d0343d21391462e8baa95b2b 100644 (file)
@@ -333,7 +333,9 @@ class SearchDescription
     public function extendWithPartialTerm($sToken, $oSearchTerm, $bStructuredPhrases, $iPhrase, $aFullTokens)
     {
         // Only allow name terms.
-        if (!(is_a($oSearchTerm, '\Nominatim\Token\Word'))) {
+        if (!(is_a($oSearchTerm, '\Nominatim\Token\Word'))
+            || strpos($sToken, ' ') !== false
+        ) {
             return array();
         }
 
@@ -361,7 +363,6 @@ class SearchDescription
 
         if ((!$this->sPostcode && !$this->aAddress && !$this->aAddressNonSearch)
             && ((empty($this->aName) && empty($this->aNameNonSearch)) || $this->iNamePhrase == $iPhrase)
-            && strpos($sToken, ' ') === false
         ) {
             $oSearch = clone $this;
             $oSearch->iSearchRank++;