Bug 571203 - Handle spaces in overlay search

Previously we were stripping all whitespace.  Instead, just strip leading+trailing
whitespace, split the remaining search into individual terms which we search
for independently.

Items are grouped by the number of terms they match, then sorted
alphabetically.
This commit is contained in:
Colin Walters
2009-02-10 14:12:13 -05:00
parent 2d3988c5fc
commit 85dae56a31
4 changed files with 68 additions and 40 deletions

View File

@ -178,15 +178,13 @@ AppDisplay.prototype = {
}
},
// Sorts the list of item ids in-place based on the alphabetical order of the names of
// the items associated with the ids.
_sortItems : function(itemIds) {
let me = this;
itemIds.sort(function (a,b) {
let appA = me._allItems[a];
let appB = me._allItems[b];
return appA.get_name().localeCompare(appB.get_name());
});
// Compares items associated with the item ids based on the alphabetical order
// of the item names.
// Returns an integer value indicating the result of the comparison.
_compareItems : function(itemIdA, itemIdB) {
let appA = this._allItems[itemIdA];
let appB = this._allItems[itemIdB];
return appA.get_name().localeCompare(appB.get_name());
},
// Checks if the item info can be a match for the search string by checking