mirror of
https://github.com/zotero/zotero.git
synced 2026-09-28 01:31:40 +00:00
citation dialog: stricter non-sql item search (#5109)
While filtering selected/open/cited items, include items that match EVERY word from the search string, as opposed to items that match ANY of the searched words. Fixes: #5099
This commit is contained in:
parent
a49e4e5449
commit
583fbf4e95
1 changed files with 6 additions and 4 deletions
|
|
@ -269,11 +269,13 @@ export class CitationDialogSearchHandler {
|
|||
let itemStr = item.getCreators()
|
||||
.map(creator => creator.firstName + " " + creator.lastName)
|
||||
.concat([item.getField("title"), item.getField("date", true, true).substr(0, 4)])
|
||||
.join(" ");
|
||||
.join(" ")
|
||||
.toLowerCase();
|
||||
|
||||
// See if words match
|
||||
for (let split of splits) {
|
||||
if (itemStr.toLowerCase().includes(split)) matchedItems.add(item);
|
||||
// Include items that match every word that was typed
|
||||
let allMatch = splits.every(split => itemStr.includes(split));
|
||||
if (allMatch) {
|
||||
matchedItems.add(item);
|
||||
}
|
||||
}
|
||||
return Array.from(matchedItems);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue