autocomplete-filters.js revision 088764cc27b7cade9d610f7e52eb6fa82f22e706
/**
* Provides pre-built result matching filters for AutoComplete.
*
* @module autocomplete
* @submodule autocomplete-filters
* @class AutoCompleteFilters
* @static
*/
var YArray = Y.Array,
YObject = Y.Object,
// -- Public Methods -------------------------------------------------------
/**
* Returns an array of results that contain all of the characters in the
* query, in any order (not necessarily consecutive). Case-insensitive.
*
* @method charMatch
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
// The caseSensitive parameter is only intended for use by
// charMatchCase(). It's intentionally undocumented.
if (!caseSensitive) {
}
});
});
},
/**
* Case-sensitive version of <code>charMatch()</code>.
*
* @method charMatchCase
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
},
/**
* Returns an array of results that contain the complete query as a phrase.
* Case-insensitive.
*
* @method phraseMatch
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
// The caseSensitive parameter is only intended for use by
// phraseMatchCase(). It's intentionally undocumented.
if (!caseSensitive) {
}
});
},
/**
* Case-sensitive version of <code>phraseMatch()</code>.
*
* @method phraseMatchCase
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
},
/**
* Returns an array of results that start with the complete query as a
* phrase. Case-insensitive.
*
* @method startsWith
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
// The caseSensitive parameter is only intended for use by
// startsWithCase(). It's intentionally undocumented.
if (!caseSensitive) {
}
});
},
/**
* Case-sensitive version of <code>startsWith()</code>.
*
* @method startsWithCase
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
},
/**
* Returns an array of results that contain all of the words in the query,
* in any order. Non-word characters like whitespace and certain punctuation
* are ignored. Case-insensitive.
*
* @method wordMatch
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
// The caseSensitive parameter is only intended for use by
// wordMatchCase(). It's intentionally undocumented.
// Convert resultWords array to a hash for fast lookup.
options));
});
});
},
/**
* Case-sensitive version of <code>wordMatch()</code>.
*
* @method wordMatchCase
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
},
/**
* Returns an array of results where all the words of the query are partially found in the result.
* Non-word characters like whitespace and certain punctuation are ignored. Case-insensitive.
* This is basically a combination of <code>wordMatch()</code> (by ignoring whitespace and word order) and <code>phraseMatch()</code> (by allowing partial matching instead of whole words).
* Example use case: Trying to find personal names independently of name order (Western or Eastern order) and supporting immediate feedback by allowing partial occurences. So queries like "J. Doe" and "Deo, John" and "J. D." would all not exclude "John Doe".
*
* @method wordOccurrence
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
// The caseSensitive parameter is only intended for use by
// wordOccurrenceCase(). It's intentionally undocumented.
if (query == '') return results; // performance optimization because the following calls will not have any effect in this case anyway
});
});
});
},
/**
* Case-sensitive version of <code>wordOccurrence()</code>.
*
* @method wordOccurrenceCase
* @param {String} query Query to match
* @param {Array} results Results to filter
* @return {Array} Filtered results
* @static
*/
}
});