]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/SearchContext.php
coding style and some documentation
[nominatim.git] / lib / SearchContext.php
index 1b48fd84985a0a6c39342ff06a0d381725e63b7d..9bab8658ac8a9b24a86cfc85cef81d83c3cd0f8b 100644 (file)
@@ -6,7 +6,7 @@ require_once(CONST_BasePath.'/lib/lib.php');
 
 
 /**
- * Collects search constraints that are independent of the
+ * Collection of search constraints that are independent of the
  * actual interpretation of the search query.
  *
  * The search context is shared between all SearchDescriptions. This
@@ -15,15 +15,25 @@ require_once(CONST_BasePath.'/lib/lib.php');
  */
 class SearchContext
 {
+    /// Search radius around a given Near reference point.
     private $fNearRadius = false;
+    /// True if search must be restricted to viewbox only.
     public $bViewboxBounded = false;
 
+    /// Reference point for search (as SQL).
     public $sqlNear = '';
+    /// Viewbox selected for search (as SQL).
     public $sqlViewboxSmall = '';
+    /// Viewbox with a larger buffer around (as SQL).
     public $sqlViewboxLarge = '';
+    /// Reference along a route (as SQL).
     public $sqlViewboxCentre = '';
+    /// List of countries to restrict search to (as SQL).
+    public $sqlCountryList = '';
+    /// List of place IDs to exclude (as SQL).
     private $sqlExcludeList = '';
 
+
     public function hasNearPoint()
     {
         return $this->fNearRadius !== false;
@@ -43,7 +53,6 @@ class SearchContext
     public function isBoundedSearch()
     {
         return $this->hasNearPoint() || ($this->sqlViewboxSmall && $this->bViewboxBounded);
-
     }
 
     public function setViewboxFromBox(&$aViewBox, $bBounded)
@@ -97,6 +106,11 @@ class SearchContext
         $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.
      *