Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search condition for all fields #1699

Closed
dstillman opened this issue May 23, 2019 · 6 comments
Closed

Search condition for all fields #1699

dstillman opened this issue May 23, 2019 · 6 comments
Assignees

Comments

@dstillman
Copy link
Member

https://forums.zotero.org/discussion/77510/search-every-field-in-advanced-saved-searches

Seems like this should be a dupe, since this is a common request, but I didn't find another issue for it.

@dstillman
Copy link
Member Author

@AbeJellinek AbeJellinek self-assigned this Nov 2, 2022
@AbeJellinek
Copy link
Member

Just All Fields & Tags, or Title, Creator, Year and Everything, too?

@dstillman
Copy link
Member Author

dstillman commented Nov 3, 2022

Maybe just "Any Field"? We already have Attachment Content, Note, and Tag conditions. Or "Any Field" could just imply Note and Tag — it already means "Note" in the quick search, and Tag is plausibly a "field". (We could also drop "& Tags" from the quick search, which sort of makes more sense given that "All Fields & Tags" matches notes — why be explicit about tags but not about notes?)

The quick search is done in a complicated, hacky way, but this shows the actual conditions used:

// Shortcut to add a condition on every table -- does not return an id
if (condition.match(/^quicksearch/)) {
var parts = Zotero.SearchConditions.parseSearchString(value);
for (let part of parts) {
if (condition == 'quicksearch-titleCreatorYearNote') {
this.addCondition('note', operator, part.text, false);
continue;
}
this.addCondition('blockStart');
// Allow searching for exact object key
if (operator == 'contains' && Zotero.Utilities.isValidObjectKey(part.text)) {
this.addCondition('key', 'is', part.text, false);
}
if (condition.startsWith('quicksearch-titleCreatorYear')) {
this.addCondition('title', operator, part.text, false);
this.addCondition('publicationTitle', operator, part.text, false);
this.addCondition('shortTitle', operator, part.text, false);
this.addCondition('court', operator, part.text, false);
this.addCondition('year', operator, part.text, false);
}
else {
this.addCondition('field', operator, part.text, false);
this.addCondition('tag', operator, part.text, false);
this.addCondition('note', operator, part.text, false);
}
this.addCondition('creator', operator, part.text, false);
if (condition == 'quicksearch-everything') {
this.addCondition('annotationText', operator, part.text, false);
this.addCondition('annotationComment', operator, part.text, false);
if (part.inQuotes) {
this.addCondition('fulltextContent', operator, part.text, false);
}
else {
var splits = Zotero.Fulltext.semanticSplitter(part.text);
for (let split of splits) {
this.addCondition('fulltextWord', operator, split, false);
}
}
}
this.addCondition('blockEnd');
}
if (condition == 'quicksearch-titleCreatorYear') {
this.addCondition('noChildren', 'true');
}
else if (condition == 'quicksearch-titleCreatorYearNote') {
this.addCondition('itemType', 'is', 'note');
}

@AbeJellinek
Copy link
Member

Should the "Any Field" advanced search condition just be quicksearch-fields? Or do we want to create a separate condition that searches all fields, tags, and note contents but doesn't have special behavior like splitting (line 300 above) and/or key matching (line 312)?

@dstillman
Copy link
Member Author

dstillman commented Nov 8, 2022

I guess it should be separate, because everything in Advanced Search is a phrase search. It shouldn't be split. (Key doesn't really matter either way.)

@dstillman
Copy link
Member Author

Closed by c294173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants