autocomplete-filters-accentfold-debug.js revision 4ead18554e0008d06914f75a9b6c2d3a1c590d74
13fdd42f1fc3e519650037a920e6a54c24973866vboxsyncYUI.add('autocomplete-filters-accentfold', function(Y) {
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Provides pre-built accent-folding result matching filters for AutoComplete.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * These filters are similar to the ones provided by the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * <code>autocomplete-filters</code> module, but use accent-aware comparisons.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * For example, "resume" and "résumé" will be considered equal when using the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * accent-folding filters.
565c6b62913edd14704b060e3172bba10b1fe12evboxsync * @module autocomplete
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * @submodule autocomplete-filters-accentfold
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * @class AutoCompleteFilters
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * Accent folding version of <code>charMatch()</code>.
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @method charMatchFold
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @param {String} query Query to match
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @param {Array} results Results to filter
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @return {Array} Filtered results
3dc9141e9dc45634498a9b543477bec0bcf5dab8vboxsync var queryChars = YArray.unique(AccentFold.fold(query).split(''));
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * Accent folding version of <code>phraseMatch()</code>.
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @method phraseMatchFold
66cd15f94910b1afc64c42375d40e01d5d33ad2fvboxsync * @param {String} query Query to match
3dc9141e9dc45634498a9b543477bec0bcf5dab8vboxsync * @param {Array} results Results to filter
3dc9141e9dc45634498a9b543477bec0bcf5dab8vboxsync * @return {Array} Filtered results
e7aa635d70dd0cdf083287ec896fe8cca2775466vboxsync return AccentFold.fold(result.text).indexOf(query) !== -1;
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Accent folding version of <code>startsWith()</code>.
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * @method startsWithFold
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * @param {String} query Query to match
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync * @param {Array} results Results to filter
7ca4727ba2f9e3703771a308b11cd551f3fca4fdvboxsync * @return {Array} Filtered results
e7aa635d70dd0cdf083287ec896fe8cca2775466vboxsync return AccentFold.fold(result.text).indexOf(query) === 0;
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * Accent folding version of <code>subWordMatch()</code>.
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @method subWordMatchFold
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @param {String} query Query to match
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @param {Array} results Results to filter
6ba8963f8a097b33938cd6fbcd6b63faf6d26889vboxsync * @return {Array} Filtered results
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync var queryWords = WordBreak.getUniqueWords(AccentFold.fold(query));
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync return YArray.every(queryWords, function (queryWord) {
13fdd42f1fc3e519650037a920e6a54c24973866vboxsync * Accent folding version of <code>wordMatch()</code>.
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @method wordMatchFold
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @param {String} query Query to match
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @param {Array} results Results to filter
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync * @return {Array} Filtered results
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync var queryWords = WordBreak.getUniqueWords(AccentFold.fold(query));
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync // Convert resultWords array to a hash for fast lookup.
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync var resultWords = YArray.hash(WordBreak.getUniqueWords(
9868c07279330f31ed91aa986bec707b7e8635a3vboxsync}, '@VERSION@' ,{requires:['array-extras', 'text-accentfold', 'text-wordbreak']});