Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/179032
Change subject: Documentation for SearchApi
......................................................................
Documentation for SearchApi
Change-Id: Idc3d1ce9276e7ede57504b306bb96ff8f0b92e9b
---
M javascripts/modules/search/SearchApi.js
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/32/179032/1
diff --git a/javascripts/modules/search/SearchApi.js
b/javascripts/modules/search/SearchApi.js
index 3049f26..4a7008e 100644
--- a/javascripts/modules/search/SearchApi.js
+++ b/javascripts/modules/search/SearchApi.js
@@ -12,6 +12,7 @@
* Escapes regular expression wildcards (metacharacters) by adding a \\
prefix
* @param {String} str a string
* @return {String} a regular expression that can be used to search for
that str
+ * @ignore
*/
function createSearchRegEx( str ) {
str = str.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&' );
@@ -22,6 +23,7 @@
* Takes a label potentially beginning with term
* and highlights term if it is present with strong
*
+ * @private
* @param {String} label a piece of text
* @param {String} term a string to search for from the start
* @return {String} safe html string with matched terms encapsulated in
strong tags
@@ -38,13 +40,19 @@
* @extends Api
*/
SearchApi = Api.extend( {
+ /** @inheritdoc */
initialize: function () {
Api.prototype.initialize.apply( this, arguments );
this.searchCache = {};
},
- // FIXME: remove filtering of redirects once the upstream bug
has been fixed:
- // https://bugzilla.wikimedia.org/show_bug.cgi?id=73673
+ /**
+ * Perform a search for the given query.
+ * FIXME: remove filtering of redirects once the upstream bug
has been fixed:
+ * https://bugzilla.wikimedia.org/show_bug.cgi?id=73673
+ * @param {String} query to search for
+ * @return {jQuery.Deferred}
+ */
search: function ( query ) {
if ( !this.searchCache[query] ) {
this.searchCache[query] = this.get( {
@@ -119,6 +127,11 @@
return this.searchCache[query];
},
+ /**
+ * Check if the search has already been performed in given
session.
+ * @param {string} query
+ * @return {Boolean}
+ */
isCached: function ( query ) {
return !!this.searchCache[query];
}
--
To view, visit https://gerrit.wikimedia.org/r/179032
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc3d1ce9276e7ede57504b306bb96ff8f0b92e9b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits