X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/86c085813044e52a4897d6a85e4ae7700bd40f91..55629a48913d6e091247105cf52d6492574691f7:/lib/SearchContext.php diff --git a/lib/SearchContext.php b/lib/SearchContext.php index 7552ae99..f5eab95a 100644 --- a/lib/SearchContext.php +++ b/lib/SearchContext.php @@ -22,6 +22,8 @@ class SearchContext public $sqlViewboxSmall = ''; public $sqlViewboxLarge = ''; public $sqlViewboxCentre = ''; + public $sqlCountryList = ''; + private $sqlExcludeList = ''; public function hasNearPoint() { @@ -91,6 +93,16 @@ class SearchContext $this->sqlViewboxLarge = "'".$sGeom."'::geometry"; } + public function setExcludeList($aExcluded) + { + $this->sqlExcludeList = ' not in ('.join(',', $aExcluded).')'; + } + + public function setCountryList($aCountries) + { + $this->sqlCountryList = '('.join(',', array_map('addQuotes', $aCountries)).')'; + } + /** * Extract a coordinate point from a query string. * @@ -138,4 +150,13 @@ class SearchContext return $sSQL; } + + public function excludeSQL($sVariable) + { + if ($this->sqlExcludeList) { + return $sVariable.$this->sqlExcludeList; + } + + return ''; + } }