From b5671859660be6fefc45b3caf9cc783103d9bbc2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 18 Jan 2013 20:54:28 +0100 Subject: [PATCH] allow country name at beginning for reverse order --- website/search.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website/search.php b/website/search.php index 5947fbc7..cea1ec03 100755 --- a/website/search.php +++ b/website/search.php @@ -533,7 +533,12 @@ { $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; } } -- 2.39.5