Check that no new term was introduced before doing a subsearch
We combine search terms with OR, so if a new search term is introduced, the search results are no longer a subset of the previous search results.
This commit is contained in:
parent
dc99e8ffcd
commit
aed1e67add
@ -370,7 +370,11 @@ GenericDisplay.prototype = {
|
|||||||
return;
|
return;
|
||||||
let flags = RedisplayFlags.RESET_CONTROLS;
|
let flags = RedisplayFlags.RESET_CONTROLS;
|
||||||
if (this._search != '') {
|
if (this._search != '') {
|
||||||
if (lowertext.indexOf(this._search) == 0)
|
// Because we combine search terms with OR, we have to be sure that no new term
|
||||||
|
// was introduced before deciding that the new search results will be a subset of
|
||||||
|
// the existing search results.
|
||||||
|
if (lowertext.indexOf(this._search) == 0 &&
|
||||||
|
lowertext.split(/\s+/).length == this._search.split(/\s+/).length)
|
||||||
flags |= RedisplayFlags.SUBSEARCH;
|
flags |= RedisplayFlags.SUBSEARCH;
|
||||||
}
|
}
|
||||||
this._search = lowertext;
|
this._search = lowertext;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user