* Registration time of users registered before the DB field was created is now
shown as empty instead of the current time.
+* API search now falls back to fulltext search by default when using Lucene
+ or other engine which doesn't support a separate title search function.
+ This means you can use API search on Wikipedia without explicitly adding
+ &srwhat=text to the query.
+
=== Languages updated in 1.14 ===
$limit = $params['limit'];
$query = $params['search'];
+ $what = $params['what'];
if (is_null($query) || empty($query))
$this->dieUsage("empty search string is not allowed", 'param-search');
$search->setNamespaces( $params['namespace'] );
$search->showRedirects = $params['redirects'];
- if ($params['what'] == 'text')
+ if ($what == 'text') {
$matches = $search->searchText( $query );
- else
+ } elseif( $what == 'title' ) {
$matches = $search->searchTitle( $query );
+ } else {
+ // We default to title searches; this is a terrible legacy
+ // of the way we initially set up the MySQL fulltext-based
+ // search engine with separate title and text fields.
+ // In the future, the default should be for a combined index.
+ $matches = $search->searchTitle( $query );
+
+ // Not all search engines support a separate title search,
+ // for instance the Lucene-based engine we use on Wikipedia.
+ // In this case, fall back to full-text search (which will
+ // include titles in it!)
+ if( is_null( $matches ) )
+ $matches = $search->searchText( $query );
+ }
if (is_null($matches))
- $this->dieUsage("{$params['what']} search is disabled",
- "search-{$params['what']}-disabled");
+ $this->dieUsage("{$what} search is disabled",
+ "search-{$what}-disabled");
$data = array ();
$count = 0;
ApiBase :: PARAM_ISMULTI => true,
),
'what' => array (
- ApiBase :: PARAM_DFLT => 'title',
+ ApiBase :: PARAM_DFLT => null,
ApiBase :: PARAM_TYPE => array (
'title',
'text',