Index: trunk/phase3/includes/api/ApiQuerySearch.php |
— | — | @@ -86,6 +86,15 @@ |
87 | 87 | if (is_null($matches)) |
88 | 88 | $this->dieUsage("{$what} search is disabled", |
89 | 89 | "search-{$what}-disabled"); |
| 90 | + |
| 91 | + $totalhits = $matches->getTotalHits(); |
| 92 | + if( $totalhits !== null ) { |
| 93 | + $this->getResult()->addValue( array( 'query', 'searchinfo' ), 'totalhits', $totalhits ); |
| 94 | + } |
| 95 | + if( $matches->hasSuggestion() ) { |
| 96 | + $this->getResult()->addValue( array( 'query', 'searchinfo' ), 'suggestion', |
| 97 | + $matches->getSuggestionQuery() ); |
| 98 | + } |
90 | 99 | |
91 | 100 | $terms = $wgContLang->convertForSearchResult($matches->termMatches()); |
92 | 101 | $titles = array (); |
— | — | @@ -106,6 +115,9 @@ |
107 | 116 | $vals = array(); |
108 | 117 | ApiQueryBase::addTitleInfo($vals, $title); |
109 | 118 | $vals['snippet'] = $result->getTextSnippet($terms); |
| 119 | + $vals['size'] = $result->getByteSize(); |
| 120 | + $vals['wordcount'] = $result->getWordCount(); |
| 121 | + $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $result->getTimestamp() ); |
110 | 122 | $fit = $this->getResult()->addValue(array('query', $this->getModuleName()), null, $vals); |
111 | 123 | if(!$fit) |
112 | 124 | { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -384,7 +384,6 @@ |
385 | 385 | * (bug 18720) Add anchor field to action=parse&prop=sections output |
386 | 386 | * (bug 19423) The initial file description page used caption in user lang |
387 | 387 | rather than UI lang |
388 | | -* Added snippet field to list=search output |
389 | 388 | * (bug 17809) Add number of users in user groups to meta=siteinfo |
390 | 389 | * (bug 18533) Add readonly reason to readonly exception |
391 | 390 | * (bug 19528) Added XSLT parameter to API queries in format=xml |
— | — | @@ -392,6 +391,9 @@ |
393 | 392 | parameter in action=edit |
394 | 393 | * (bug 19090) Added watchlist parameter, deprecated watch and unwatch |
395 | 394 | parameter in action=edit |
| 395 | +* Added fields to list=search output: size, wordcount, timestamp, snippet |
| 396 | +* Where supported by backend, list=search adds a 'searchinfo' element with |
| 397 | + optional info: 'totalhits' count and 'suggestion' alternate query term |
396 | 398 | |
397 | 399 | === Languages updated in 1.16 === |
398 | 400 | |