From: Sarah Hoffmann Date: Sun, 23 May 2021 20:13:03 +0000 (+0200) Subject: always ignore multi term partials in search X-Git-Tag: v4.0.0~74^2~3 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/02f6afa51bb9f25e562853d87d8eccaeaa3f0b6a always ignore multi term partials in search Partial terms should only ever consist of one word. Ignore any other, they are a leftover from inefficient word index builts. --- diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 189ffa74..8da49a9f 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -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++;