]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix use of term count in partial terms
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Dec 2020 16:21:01 +0000 (17:21 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Dec 2020 16:21:01 +0000 (17:21 +0100)
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.

lib/SearchDescription.php

index 1e1955c249a7e8a498a9c1d92d4bc08991fbf6b1..63241003097d235a16b296f4dfd9d8a514e3a83b 100644 (file)
@@ -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++;