Limit Everything full-text-word subsearch to current library

This fixes an error using Everything if another library hasn't yet been
loaded and should speed up Everything searches for people with multiple
libraries.

This is sort of an awkward fix, because it doesn't fix the underlying
problem of `addCondition('libraryID', ...)` not working the same as
`.libraryID =` for some search conditions that perform subsearches. But
supporting `addCondition('libraryID', ...)` for those would get
complicated, because there could technically be multiple such
conditions, and applying those to a subsearch that used `AND` would get
messy. So let's just fix the problem at hand.

Fixes #3032
This commit is contained in:
Dan Stillman 2023-03-21 16:01:29 -04:00
parent 1aa82094f1
commit 6ac13e3281

View file

@ -366,7 +366,7 @@ Zotero.CollectionTreeRow.prototype.getSearchObject = Zotero.Promise.coroutine(fu
else { else {
var s = new Zotero.Search(); var s = new Zotero.Search();
if (!this.isFeeds()) { if (!this.isFeeds()) {
s.addCondition('libraryID', 'is', this.ref.libraryID); s.libraryID = this.ref.libraryID;
} }
// Library root // Library root
if (this.isLibrary(true)) { if (this.isLibrary(true)) {
@ -403,7 +403,7 @@ Zotero.CollectionTreeRow.prototype.getSearchObject = Zotero.Promise.coroutine(fu
s2.addCondition('feed', true); s2.addCondition('feed', true);
} }
else { else {
s2.addCondition('libraryID', 'is', this.ref.libraryID); s2.libraryID = this.ref.libraryID;
} }
if (this.isTrash()) { if (this.isTrash()) {