Merge "SearchInputWidget: Support searching a namespaces besides 0"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 17 Dec 2016 02:25:03 +0000 (02:25 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 17 Dec 2016 02:25:04 +0000 (02:25 +0000)
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js
resources/src/mediawiki/mediawiki.searchSuggest.js

index 2ac75c5..0a73bef 100755 (executable)
@@ -34,7 +34,8 @@
                        icon: 'search',
                        maxLength: undefined,
                        performSearchOnClick: true,
-                       dataLocation: 'header'
+                       dataLocation: 'header',
+                       namespace: 0
                }, config );
 
                // Parent constructor
@@ -83,7 +84,7 @@
                        self = this;
 
                // reuse the searchSuggest function from mw.searchSuggest
-               promise = mw.searchSuggest.request( api, this.getQueryValue(), $.noop, this.limit );
+               promise = mw.searchSuggest.request( api, this.getQueryValue(), $.noop, this.limit, this.getNamespace() );
 
                // tracking purposes
                promise.done( function ( data, jqXHR ) {
index fa1a78c..ce5f66a 100644 (file)
@@ -4,12 +4,12 @@
 ( function ( mw, $ ) {
        mw.searchSuggest = {
                // queries the wiki and calls response with the result
-               request: function ( api, query, response, maxRows ) {
+               request: function ( api, query, response, maxRows, namespace ) {
                        return api.get( {
                                formatversion: 2,
                                action: 'opensearch',
                                search: query,
-                               namespace: 0,
+                               namespace: namespace || 0,
                                limit: maxRows,
                                suggest: true
                        } ).done( function ( data, jqXHR ) {