From: Brian Quinion Date: Thu, 24 Jan 2013 18:25:59 +0000 (+0000) Subject: for structured queries assume 2 char country param values are a iso country code X-Git-Tag: v2.2.0~128 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/4bc40d2c0bc591e7738fc762e74c18e11d1922a1?hp=fb76671ab9fbe6e6f40b53d8cdd4250820f79a92 for structured queries assume 2 char country param values are a iso country code --- diff --git a/website/search.php b/website/search.php index 80a05a64..3e8e5b79 100755 --- a/website/search.php +++ b/website/search.php @@ -416,6 +416,13 @@ $aWordFrequencyScores = array(); foreach($aDatabaseWords as $aToken) { + // Very special case - require 2 letter country param to match the country code found + if ($bStructuredPhrases && $aToken['country_code'] && !empty($aStructuredQuery['country']) + && strlen($aStructuredQuery['country']) == 2 && strtolower($aStructuredQuery['country']) != $aToken['country_code']) + { + continue; + } + if (isset($aValidTokens[$aToken['word_token']])) { $aValidTokens[$aToken['word_token']][] = $aToken;