| Index: trunk/extensions/GeoData/ApiQueryGeoSearch.php |
| — | — | @@ -69,6 +69,7 @@ |
| 70 | 70 | } else { |
| 71 | 71 | $this->addFields( array( "{$dbr->tableName( 'page' )}.*" ) ); |
| 72 | 72 | } |
| | 73 | + $this->addWhereFld( 'gt_globe', $params['globe'] ); |
| 73 | 74 | $this->addWhereRange( 'gt_lat', 'newer', $rect["minLat"], $rect["maxLat"], false ); |
| 74 | 75 | $this->addWhereRange( 'gt_lon', 'newer', $rect["minLon"], $rect["maxLon"], false ); |
| 75 | 76 | //$this->addWhere( 'dist < ' . intval( $radius ) ); hasta be in HAVING, not WHERE |
| — | — | @@ -95,7 +96,9 @@ |
| 96 | 97 | 'pageid' => intval( $row->page_id ), |
| 97 | 98 | 'ns' => intval( $title->getNamespace() ), |
| 98 | 99 | 'title' => $title->getPrefixedText(), |
| 99 | | - 'dist' => $row->dist, |
| | 100 | + 'lat' => $row->gt_lat, |
| | 101 | + 'lon' => $row->gt_lon, |
| | 102 | + 'dist' => round( $row->dist, 1 ), |
| 100 | 103 | ); |
| 101 | 104 | $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); |
| 102 | 105 | if ( !$fit ) { |
| — | — | @@ -108,7 +111,7 @@ |
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | public function getAllowedParams() { |
| 112 | | - global $wgMaxGeoSearchRadius; |
| | 115 | + global $wgMaxGeoSearchRadius, $wgDefaultGlobe; |
| 113 | 116 | return array ( |
| 114 | 117 | 'coord' => array( |
| 115 | 118 | ApiBase::PARAM_TYPE => 'string', |
| — | — | @@ -133,16 +136,22 @@ |
| 134 | 137 | ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, |
| 135 | 138 | ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 |
| 136 | 139 | ), |
| | 140 | + 'globe' => array( |
| | 141 | + ApiBase::PARAM_TYPE => 'string', |
| | 142 | + ApiBase::PARAM_DFLT => $wgDefaultGlobe, |
| | 143 | + ), |
| 137 | 144 | ); |
| 138 | 145 | } |
| 139 | 146 | |
| 140 | 147 | public function getParamDescription() { |
| | 148 | + global $wgDefaultGlobe; |
| 141 | 149 | return array( |
| 142 | 150 | 'coord' => 'Coordinate around which to search: two floating-point values separated by pipe (|)', |
| 143 | 151 | 'page' => 'Page around which to search', |
| 144 | 152 | 'radius' => 'Search radius in meters', |
| 145 | 153 | 'maxdim' => 'Restrict search to onjects no larger than this, in meters', |
| 146 | 154 | 'limit' => 'Maximum number of pages to return', |
| | 155 | + 'globe' => "Globe to search on (by default `{$wgDefaultGlobe}')", |
| 147 | 156 | ); |
| 148 | 157 | } |
| 149 | 158 | |