From: jenkins-bot Date: Wed, 13 Jun 2018 16:36:58 +0000 (+0000) Subject: Merge "Move RELEASE-NOTES-1.31 into HISTORY" X-Git-Tag: 1.34.0-rc.0~5081 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=70c79f3fc255a5da5650f275bceecba72b8e3f91;hp=ebb3da76de05a4ddfd7c58348c5c1df404124ad7;p=lhc%2Fweb%2Fwiklou.git Merge "Move RELEASE-NOTES-1.31 into HISTORY" --- diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 708c944eb9..3d87a5f06a 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -60,6 +60,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { // Create search engine instance and set options $search = $this->buildSearchEngine( $params ); + if ( isset( $params['sort'] ) ) { + $search->setSort( $params['sort'] ); + } $search->setFeatureData( 'rewrite', (bool)$params['enablerewrites'] ); $search->setFeatureData( 'interwiki', (bool)$interwiki ); @@ -382,6 +385,20 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { 'enablerewrites' => false, ]; + // If we have more than one engine the list of available sorts is + // difficult to represent. For now don't expose it. + $alternatives = MediaWiki\MediaWikiServices::getInstance() + ->getSearchEngineConfig() + ->getSearchTypes(); + if ( count( $alternatives ) == 1 ) { + $this->allowedParams['sort'] = [ + ApiBase::PARAM_DFLT => 'relevance', + ApiBase::PARAM_TYPE => MediaWiki\MediaWikiServices::getInstance() + ->newSearchEngine() + ->getValidSorts(), + ]; + } + return $this->allowedParams; } diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index e1ba665549..94e1ac6716 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -1165,6 +1165,7 @@ "apihelp-query+search-param-interwiki": "Include interwiki results in the search, if available.", "apihelp-query+search-param-backend": "Which search backend to use, if not the default.", "apihelp-query+search-param-enablerewrites": "Enable internal query rewriting. Some search backends can rewrite the query into another which is thought to provide better results, for instance by correcting spelling errors.", + "apihelp-query+search-param-sort": "Set the sort order of returned results.", "apihelp-query+search-example-simple": "Search for meaning.", "apihelp-query+search-example-text": "Search texts for meaning.", "apihelp-query+search-example-generator": "Get page info about the pages returned for a search for meaning.", diff --git a/includes/api/i18n/qqq.json b/includes/api/i18n/qqq.json index 3fcf499afc..1680bb87b1 100644 --- a/includes/api/i18n/qqq.json +++ b/includes/api/i18n/qqq.json @@ -1088,6 +1088,7 @@ "apihelp-query+search-param-interwiki": "{{doc-apihelp-param|query+search|interwiki}}", "apihelp-query+search-param-backend": "{{doc-apihelp-param|query+search|backend}}", "apihelp-query+search-param-enablerewrites": "{{doc-apihelp-param|query+search|enablerewrites}}", + "apihelp-query+search-param-sort": "{{doc-apihelp-param|query+search|sort}}", "apihelp-query+search-example-simple": "{{doc-apihelp-example|query+search}}", "apihelp-query+search-example-text": "{{doc-apihelp-example|query+search}}", "apihelp-query+search-example-generator": "{{doc-apihelp-example|query+search}}", diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e50512dc95..ee098ddc6c 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1416,7 +1416,7 @@ "rcfilters-empty-filter": "No active filters. All contributions are shown.", "rcfilters-filterlist-title": "Filters", "rcfilters-filterlist-whatsthis": "How do these work?", - "rcfilters-filterlist-feedbacklink": "Tell us what you think about these (new) filtering tools", + "rcfilters-filterlist-feedbacklink": "Tell us what you think about these filtering tools", "rcfilters-highlightbutton-title": "Highlight results", "rcfilters-highlightmenu-title": "Select a color", "rcfilters-highlightmenu-help": "Select a color to highlight this property",