MediaWiki r53904 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r53903‎ | r53904 (on ViewVC)‎ | r53905 >
Date:21:13, 28 July 2009
Author:brion
Status:ok
Tags:
Comment:
* Added fields to list=search output: size, wordcount, timestamp, snippet
* Where supported by backend, list=search adds a 'searchinfo' element with
optional info: 'totalhits' count and 'suggestion' alternate query term

Snippets added to result items earlier by Roan; extended this with the other
byte size, word count, and timestamp available on the result items and exposed
through the regular UI.

Had to work out a backwards-compatible method for the search meta-information
with Roan; added a second 'searchinfo' element since adding attributes to
'search' would break compatibility for JSON output (despite being safe in XML).

'searchinfo' is present only if the backend supports the extra info and has
something available; 'totalhits' with a total hit count and 'suggestion' for
an alternate query suggestion (exposed as "Did you mean X?" link in UI).

Note that total hit counts can be enabled for MySQL backend now by setting
the experimental option $wgSearchMySQLTotalHits, but did-you-mean suggestions
are not yet supported and need to be tested with a hack or another backend.

Sample XML and JSON output with the new searchinfo items (which can be
present whether or not there are any result items):

<?xml version="1.0"?>
<api>
<query>
<searchinfo totalhits="0" suggestion="joe momma" />
<search />
</query>
</api>

{
"query": {
"searchinfo": {
"totalhits": 0,
"suggestion": "joe momma"
},
"search": [

]
}
}

The suggestion value is suitable for plugging back in as a search term,
if present.
Modified paths:

Diff [purge]

Loading diff…

Follow-up revisions

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

Status & tagging log