search: Simplify and correct behavior for substring searches

Early on, search was based on a list of terms, which was like a set
of tags, in that terms were OR'd, and that order didn't matter. As
such, modifying any one of the terms wouldn't produce new results.
Nowadays, providers take the order into account, so a substring
should only be the case if new terms are added to the end.

https://bugzilla.gnome.org/show_bug.cgi?id=693935
This commit is contained in:
Jasper St. Pierre 2013-02-15 23:10:42 -05:00
parent 5c7f0a0ad8
commit b292bba092

View File

@ -64,15 +64,12 @@ const SearchSystem = new Lang.Class({
if (!terms)
return;
let isSubSearch = terms.length == this._previousTerms.length;
if (isSubSearch) {
for (let i = 0; i < terms.length; i++) {
if (terms[i].indexOf(this._previousTerms[i]) != 0) {
isSubSearch = false;
break;
}
}
}
let searchString = terms.join(' ');
let previousSearchString = this._previousTerms.join(' ');
let isSubSearch = false;
if (this._previousTerms.length > 0)
isSubSearch = searchString.indexOf(previousSearchString) == 0;
let previousResultsArr = this._previousResults;