r108079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108078‎ | r108079 | r108080 >
Date:20:10, 4 January 2012
Author:maxsem
Status:resolved (Comments)
Tags:
Comment:
* Coordinates in the list
* Filtering by globe
* Round the distance, we don't need ångströms here
Modified paths:
  • /trunk/extensions/GeoData/ApiQueryGeoSearch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GeoData/ApiQueryGeoSearch.php
@@ -69,6 +69,7 @@
7070 } else {
7171 $this->addFields( array( "{$dbr->tableName( 'page' )}.*" ) );
7272 }
 73+ $this->addWhereFld( 'gt_globe', $params['globe'] );
7374 $this->addWhereRange( 'gt_lat', 'newer', $rect["minLat"], $rect["maxLat"], false );
7475 $this->addWhereRange( 'gt_lon', 'newer', $rect["minLon"], $rect["maxLon"], false );
7576 //$this->addWhere( 'dist < ' . intval( $radius ) ); hasta be in HAVING, not WHERE
@@ -95,7 +96,9 @@
9697 'pageid' => intval( $row->page_id ),
9798 'ns' => intval( $title->getNamespace() ),
9899 'title' => $title->getPrefixedText(),
99 - 'dist' => $row->dist,
 100+ 'lat' => $row->gt_lat,
 101+ 'lon' => $row->gt_lon,
 102+ 'dist' => round( $row->dist, 1 ),
100103 );
101104 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
102105 if ( !$fit ) {
@@ -108,7 +111,7 @@
109112 }
110113
111114 public function getAllowedParams() {
112 - global $wgMaxGeoSearchRadius;
 115+ global $wgMaxGeoSearchRadius, $wgDefaultGlobe;
113116 return array (
114117 'coord' => array(
115118 ApiBase::PARAM_TYPE => 'string',
@@ -133,16 +136,22 @@
134137 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
135138 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
136139 ),
 140+ 'globe' => array(
 141+ ApiBase::PARAM_TYPE => 'string',
 142+ ApiBase::PARAM_DFLT => $wgDefaultGlobe,
 143+ ),
137144 );
138145 }
139146
140147 public function getParamDescription() {
 148+ global $wgDefaultGlobe;
141149 return array(
142150 'coord' => 'Coordinate around which to search: two floating-point values separated by pipe (|)',
143151 'page' => 'Page around which to search',
144152 'radius' => 'Search radius in meters',
145153 'maxdim' => 'Restrict search to onjects no larger than this, in meters',
146154 'limit' => 'Maximum number of pages to return',
 155+ 'globe' => "Globe to search on (by default `{$wgDefaultGlobe}')",
147156 );
148157 }
149158

Comments

#Comment by Preilly (talk | contribs)   19:18, 6 January 2012

I think it should be `` not ` on the following line:

+			'globe' => "Globe to search on (by default `{$wgDefaultGlobe}')",
#Comment by MaxSem (talk | contribs)   20:26, 6 January 2012

Thanks, r108279

Status & tagging log