From 092295da22dd5b1bf46e49cf9a35294cb4a2dbcf Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 23 Jun 2026 11:47:58 -0400 Subject: [PATCH] Add result-level controls to the Advanced Search builder (#5962) - Reword the header as one sentence with a result-level menu ("Find [attachments] matching [all] of the following:") - Provide a per-group menu to bind the group's descendant conditions to the same attachment, note, or annotation (e.g., one annotation that is both red and contains a given word, not two different ones) - Show a hint that offers to group ungrouped sibling conditions (e.g., two annotation conditions at the top level, to bind them to one annotation) - Show a warning when conditions can't combine at the chosen result level (e.g., an annotation condition with a note result level) - Remove the two legacy checkboxes: - "Show top-level items" becomes result level = top-level item and is migrated on save - "Include parent and child items", which has no result-level equivalent, keeps working, stays editable, and round-trips on searches that already have it, but it isn't offered on new searches and is removed on save if unchecked --- .../zotero/elements/advancedSearchPane.js | 3 + .../content/zotero/elements/zoteroSearch.js | 424 +++++++++++++++++- chrome/locale/en-US/zotero/zotero.ftl | 51 +++ scss/elements/_advancedSearchPane.scss | 2 +- scss/elements/_zoteroSearch.scss | 109 ++++- scss/themes/_dark.scss | 1 + scss/themes/_light.scss | 1 + test/tests/advancedSearchTest.js | 356 +++++++++++++++ 8 files changed, 931 insertions(+), 16 deletions(-) diff --git a/chrome/content/zotero/elements/advancedSearchPane.js b/chrome/content/zotero/elements/advancedSearchPane.js index 5a2a648a38..93669520e5 100644 --- a/chrome/content/zotero/elements/advancedSearchPane.js +++ b/chrome/content/zotero/elements/advancedSearchPane.js @@ -127,6 +127,9 @@ } else { this._search = new Zotero.Search(); + // Default a fresh search to top-level items, so a condition on a child + // (e.g. attachment content) maps up to its item without any grouping + this._search.addCondition('resultLevel', 'item'); this._search.addCondition('title', 'contains', ''); } this._searchElem.search = this._search; diff --git a/chrome/content/zotero/elements/zoteroSearch.js b/chrome/content/zotero/elements/zoteroSearch.js index 164603992e..9ae1de255d 100644 --- a/chrome/content/zotero/elements/zoteroSearch.js +++ b/chrome/content/zotero/elements/zoteroSearch.js @@ -38,9 +38,11 @@ class ZoteroSearch extends SearchElementBase { content = MozXULElement.parseXULToFragment(` +