mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
drop searches with excluded country codes earlier
This commit is contained in:
@@ -922,7 +922,7 @@ class Geocode
|
|||||||
//if (CONST_Debug) _debugDumpGroupedSearches($aGroupedSearches, $aValidTokens);
|
//if (CONST_Debug) _debugDumpGroupedSearches($aGroupedSearches, $aValidTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revisit searches, giving penalty to unlikely combinations
|
// Revisit searches, drop bad searches and give penalty to unlikely combinations.
|
||||||
$aGroupedSearches = array();
|
$aGroupedSearches = array();
|
||||||
foreach ($aSearches as $aSearch) {
|
foreach ($aSearches as $aSearch) {
|
||||||
if (!$aSearch['aName']) {
|
if (!$aSearch['aName']) {
|
||||||
@@ -930,6 +930,11 @@ class Geocode
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->aCountryCodes && $aSearch['sCountryCode']
|
||||||
|
&& !in_array($aSearch['sCountryCode'], $this->aCountryCodes)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$aSearch['iSearchRank'] += $iGlobalRank;
|
$aSearch['iSearchRank'] += $iGlobalRank;
|
||||||
$aGroupedSearches[$aSearch['iSearchRank']][] = $aSearch;
|
$aGroupedSearches[$aSearch['iSearchRank']][] = $aSearch;
|
||||||
}
|
}
|
||||||
@@ -1256,10 +1261,6 @@ class Geocode
|
|||||||
if (CONST_Debug) echo "<hr><b>Search Loop, group $iGroupLoop, loop $iQueryLoop</b>";
|
if (CONST_Debug) echo "<hr><b>Search Loop, group $iGroupLoop, loop $iQueryLoop</b>";
|
||||||
if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens);
|
if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens);
|
||||||
|
|
||||||
if ($sCountryCodesSQL && $aSearch['sCountryCode'] && !in_array($aSearch['sCountryCode'], $this->aCountryCodes)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No location term?
|
// No location term?
|
||||||
if (!sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress'])) {
|
if (!sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress'])) {
|
||||||
if ($aSearch['sCountryCode'] && !$aSearch['sClass'] && !$aSearch['sHouseNumber'] && !$aSearch['oNear']) {
|
if ($aSearch['sCountryCode'] && !$aSearch['sClass'] && !$aSearch['sHouseNumber'] && !$aSearch['oNear']) {
|
||||||
|
|||||||
Reference in New Issue
Block a user