r52854 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52853‎ | r52854 | r52855 >
Date:20:17, 7 July 2009
Author:catrope
Status:ok
Tags:
Comment:
API: Add snippet field to list=search output
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySearch.php
@@ -48,7 +48,7 @@
4949 }
5050
5151 private function run($resultPageSet = null) {
52 -
 52+ global $wgContLang;
5353 $params = $this->extractRequestParams();
5454
5555 $limit = $params['limit'];
@@ -87,6 +87,7 @@
8888 $this->dieUsage("{$what} search is disabled",
8989 "search-{$what}-disabled");
9090
 91+ $terms = $wgContLang->convertForSearchResult($matches->termMatches());
9192 $titles = array ();
9293 $count = 0;
9394 while( $result = $matches->next() ) {
@@ -104,6 +105,7 @@
105106 if (is_null($resultPageSet)) {
106107 $vals = array();
107108 ApiQueryBase::addTitleInfo($vals, $title);
 109+ $vals['snippet'] = $result->getTextSnippet($terms);
108110 $fit = $this->getResult()->addValue(array('query', $this->getModuleName()), null, $vals);
109111 if(!$fit)
110112 {
Index: trunk/phase3/RELEASE-NOTES
@@ -268,6 +268,7 @@
269269 * (bug 18720) Add anchor field to action=parse&prop=sections output
270270 * (bug 19423) The initial file description page used caption in user lang
271271 rather than UI lang
 272+* Added snippet field to list=search output
272273
273274 === Languages updated in 1.16 ===
274275

Follow-up revisions

RevisionCommit summaryAuthorDate
r53905Merge r52854, r53904 to deployment -- API search enhancementsbrion21:30, 28 July 2009

Status & tagging log