]> git.openstreetmap.org Git - nominatim.git/commitdiff
correct penalty for multi-word countries
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 14 Oct 2012 14:09:12 +0000 (16:09 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 14 Oct 2012 14:13:22 +0000 (16:13 +0200)
Country name needs to be the final one within the wordset, not
in the final of all wordsets.

website/search.php

index 30f7abde0e47ea2e49ef6199e039ec3e85c9f612..91869c3efaf22dc26e3f081893ecf948e405035c 100755 (executable)
                                {
                                        $aNewPhraseSearches = array();
 
-                                       foreach($aPhrases[$iPhrase]['wordsets'] as $iWordset => $aWordset)
+                                       foreach($aPhrases[$iPhrase]['wordsets'] as $aWordset)
                                        {
                                                $aWordsetSearches = $aSearches;
 
                                                // Add all words from this wordset
-                                               foreach($aWordset as $sToken)
+                                               foreach($aWordset as $iToken => $sToken)
                                                {
 //echo "<br><b>$sToken</b>";
                                                        $aNewWordsetSearches = array();
                                                                                        {
                                                                                                $aSearch['sCountryCode'] = strtolower($aSearchTerm['country_code']);
                                                                                                // Country is almost always at the end of the string - increase score for finding it anywhere else (optimisation)
-                                                                                               if ($iWordset+1 != sizeof($aPhrases[$iPhrase]['wordsets']) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5;
+                                                                                               if ($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5;
                                                                                                if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
                                                                                        }
                                                                                }