jenkins-bot has submitted this change and it was merged.
Change subject: Expose the ability to change suggestion api's
......................................................................
Expose the ability to change suggestion api's
We want to run some tests with alternate suggestions algorithms. This
allows code in the WikimediaEvents repository to replace the api call
with its own method of generating suggestions.
Related WikimediaEvents patch: I595db33
Bug: T111091
Change-Id: I1fab57ea3c0506b9b6183d214a29b978a388bc29
(cherry picked from commit a6e585ed4a7b9d0f473888de8f30e70b835a09d5)
---
M resources/src/mediawiki/mediawiki.searchSuggest.js
1 file changed, 15 insertions(+), 9 deletions(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/src/mediawiki/mediawiki.searchSuggest.js
b/resources/src/mediawiki/mediawiki.searchSuggest.js
index 5292e80..a20d7f0 100644
--- a/resources/src/mediawiki/mediawiki.searchSuggest.js
+++ b/resources/src/mediawiki/mediawiki.searchSuggest.js
@@ -2,6 +2,20 @@
* Add search suggestions to the search form.
*/
( function ( mw, $ ) {
+ mw.searchSuggest = {
+ request: function ( api, query, response, maxRows ) {
+ return api.get( {
+ action: 'opensearch',
+ search: query,
+ namespace: 0,
+ limit: maxRows,
+ suggest: ''
+ } ).done( function ( data ) {
+ response( data[ 1 ] );
+ } );
+ }
+ };
+
$( function () {
var api, map, searchboxesSelectors,
// Region where the suggestions box will appear
directly below
@@ -172,15 +186,7 @@
api = api || new mw.Api();
- $.data( node, 'request', api.get( {
- action: 'opensearch',
- search: query,
- namespace: 0,
- limit: maxRows,
- suggest: ''
- } ).done( function ( data ) {
- response( data[ 1 ] );
- } ) );
+ $.data( node, 'request',
mw.searchSuggest.request( api, query, response, maxRows ) );
},
cancel: function () {
var node = this[0],
--
To view, visit https://gerrit.wikimedia.org/r/237106
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1fab57ea3c0506b9b6183d214a29b978a388bc29
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf21
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits