From 02f6afa51bb9f25e562853d87d8eccaeaa3f0b6a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 23 May 2021 22:13:03 +0200 Subject: [PATCH] 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. --- lib-php/SearchDescription.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++; -- 2.39.5