EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/237106

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/237106/1

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: newchange
Gerrit-Change-Id: I1fab57ea3c0506b9b6183d214a29b978a388bc29
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf21
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to