mediawiki.searchSuggest: Enable result caching
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 21 May 2014 14:03:58 +0000 (16:03 +0200)
committerKrinkle <krinklemail@gmail.com>
Sat, 7 Jun 2014 08:13:43 +0000 (08:13 +0000)
Also remove redundant 'delay' option, this is 120 by default.

Bug: 65581
Change-Id: I38d5fe0cb9bb883d398295a97e30c29d68211e31

resources/src/mediawiki/mediawiki.searchSuggest.js

index 282cf6f..a314dcb 100644 (file)
                ];
                $( searchboxesSelectors.join( ', ' ) )
                        .suggestions( {
-                               fetch: function ( query ) {
-                                       var $textbox = this,
-                                               node = this[0];
+                               fetch: function ( query, response ) {
+                                       var node = this[0];
 
                                        api = api || new mw.Api();
 
                                                namespace: 0,
                                                suggest: ''
                                        } ).done( function ( data ) {
-                                               $textbox.suggestions( 'suggestions', data[1] );
+                                               response( data[ 1 ] );
                                        } ) );
                                },
                                cancel: function () {
                                                return true;
                                        }
                                },
-                               delay: 120,
+                               cache: true,
                                highlightInput: true
                        } )
                        .bind( 'paste cut drop', function () {