]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow country name at beginning for reverse order
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 18 Jan 2013 19:54:28 +0000 (20:54 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 18 Jan 2013 19:56:46 +0000 (20:56 +0100)
website/search.php

index 5947fbc7140998a46d2a5457ca773f96a1295935..cea1ec030ce81c477230f1a81af2939ceba9d7eb 100755 (executable)
                                                                                        {
                                                                                                $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 ($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5;
+                                                                                               // If reverse order is enabled, it may appear at the beginning as well.
+                                                                                               if (($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) &&
+                                                                                                               (!$bReverseInPlan || $iToken > 0 || $iPhrase > 0))
+                                                                                               {
+                                                                                                       $aSearch['iSearchRank'] += 5;
+                                                                                               }
                                                                                                if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
                                                                                        }
                                                                                }