]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/SearchContext.php
Merge pull request #1155 from lonvia/namespace-for-phpunit
[nominatim.git] / lib / SearchContext.php
index b0ff38d85c05e70a003968571cfa207445ebd8f8..84159b83ca21c660112df8d4c8ed27837ff6ce19 100644 (file)
@@ -108,8 +108,8 @@ class SearchContext
             $aViewBox[3]
         );
 
             $aViewBox[3]
         );
 
-        $fHeight = $aViewBox[0] - $aViewBox[2];
-        $fWidth = $aViewBox[1] - $aViewBox[3];
+        $fHeight = abs($aViewBox[0] - $aViewBox[2]);
+        $fWidth = abs($aViewBox[1] - $aViewBox[3]);
 
         $this->sqlViewboxLarge = sprintf(
             'ST_SetSRID(ST_MakeBox2D(ST_Point(%F,%F),ST_Point(%F,%F)),4326)',
 
         $this->sqlViewboxLarge = sprintf(
             'ST_SetSRID(ST_MakeBox2D(ST_Point(%F,%F),ST_Point(%F,%F)),4326)',
@@ -267,4 +267,18 @@ class SearchContext
 
         return '';
     }
 
         return '';
     }
+
+    public function debugInfo()
+    {
+        return array(
+                'Near radius' => $this->fNearRadius,
+                'Near point (SQL)' => $this->sqlNear,
+                'Bounded viewbox' => $this->bViewboxBounded,
+                'Viewbox (SQL, small)' => $this->sqlViewboxSmall,
+                'Viewbox (SQL, large)' => $this->sqlViewboxLarge,
+                'Viewbox (SQL, centre)' => $this->sqlViewboxCentre,
+                'Countries (SQL)' => $this->sqlCountryList,
+                'Excluded IDs (SQL)' => $this->sqlExcludeList
+               );
+    }
 }
 }