From: Sarah Hoffmann Date: Tue, 1 Dec 2020 16:21:01 +0000 (+0100) Subject: fix use of term count in partial terms X-Git-Tag: v3.6.0~14^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/df12954312c2f55a072bde265afa84e696e93606 fix use of term count in partial terms Term count for partial words is one less than the actual number of words. Take that into account when adding to the search rank. Fixes #2081. --- diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 1e1955c2..63241003 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -344,7 +344,7 @@ class SearchDescription ) { if ($oSearchTerm->iSearchNameCount < CONST_Max_Word_Frequency) { $oSearch = clone $this; - $oSearch->iSearchRank += $oSearchTerm->iTermCount; + $oSearch->iSearchRank += $oSearchTerm->iTermCount + 1; if (empty($this->aName)) { $oSearch->iSearchRank++; } @@ -355,7 +355,7 @@ class SearchDescription $aNewSearches[] = $oSearch; } else { $oSearch = clone $this; - $oSearch->iSearchRank++; + $oSearch->iSearchRank += $oSearchTerm->iTermCount + 1; $oSearch->aAddressNonSearch[$iWordID] = $iWordID; if (!empty($aFullTokens)) { $oSearch->iSearchRank++;