mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
Rename the similarity condition and quick-search mode to bestMatch
"bestMatch" names what the condition does -- rank results by how well they match the text -- rather than the current scoring mechanism, so the name can account for later changes to how it works. Rename the condition-facing identifiers with it; the embeddings engine keeps its similarity vocabulary.
This commit is contained in:
parent
29bbaf9e6f
commit
b201be5d5a
4 changed files with 12 additions and 12 deletions
|
|
@ -749,9 +749,9 @@ class CollectionViewItemTreeRowProvider extends ItemTreeRowProvider {
|
|||
refresh = true;
|
||||
madeChanges = true;
|
||||
}
|
||||
// Under an active similarity quick search, handle removals with a full refresh too
|
||||
// Under an active best-match quick search, handle removals with a full refresh too
|
||||
else if (['remove', 'delete', 'trash'].includes(action)
|
||||
&& collectionTreeRows.some(row => row.isSimilaritySearch())) {
|
||||
&& collectionTreeRows.some(row => row.isBestMatchSearch())) {
|
||||
this.itemTree.invalidateRowCache(ids);
|
||||
refresh = true;
|
||||
madeChanges = true;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
everything: Zotero.getString('quickSearch.mode.everything')
|
||||
};
|
||||
if (Zotero.Embeddings.isEnabled()) {
|
||||
modes.similarity = Zotero.getString('quickSearch-mode-similarity');
|
||||
modes.bestMatch = Zotero.getString('quickSearch-mode-similarity');
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
this._advancedButton = advancedButton;
|
||||
}
|
||||
|
||||
// Dropdown selecting how many results the similarity mode keeps;
|
||||
// Dropdown selecting how many results the best-match mode keeps;
|
||||
// shown in place of the Advanced Search button
|
||||
let topKList = document.createXULElement('menulist');
|
||||
topKList.id = 'zotero-tb-search-topk';
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
|
||||
// Advanced Search doesn't apply to semantic search, so swap its
|
||||
// button for the similarity result-count dropdown
|
||||
let isSimilarity = mode === 'similarity';
|
||||
let isSimilarity = mode === 'bestMatch';
|
||||
if (this._advancedButton) {
|
||||
this._advancedButton.hidden = isSimilarity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ Zotero.CollectionTreeRow.prototype.getSearchResults = async function (asTempTabl
|
|||
// ranking succeeds, so a ranking failure (e.g. model not yet
|
||||
// downloaded) doesn't leave the full unranked scope cached as the
|
||||
// search result.
|
||||
if (this.isSimilaritySearch()) {
|
||||
if (this.isBestMatchSearch()) {
|
||||
results = await Zotero.Embeddings.rankItemIDs(
|
||||
this.searchText, results,
|
||||
{ limit: Zotero.Prefs.get('search.quicksearch-semantic-topK') }
|
||||
|
|
@ -507,9 +507,9 @@ Zotero.CollectionTreeRow.prototype.getSearchObject = async function (options = {
|
|||
// Add Quick Search unless advanced search is enabled
|
||||
if (this.searchText && !this.advancedSearch) {
|
||||
let mode = this.searchMode || Zotero.Prefs.get('search.quicksearch-mode');
|
||||
// The similarity mode isn't a SQL condition -- the base search returns
|
||||
// The best-match mode isn't a SQL condition -- the base search returns
|
||||
// the full scope and getSearchResults() re-ranks it semantically.
|
||||
if (mode !== 'similarity') {
|
||||
if (mode !== 'bestMatch') {
|
||||
s2.addCondition('quicksearch-' + mode, 'contains', this.searchText);
|
||||
}
|
||||
}
|
||||
|
|
@ -637,7 +637,7 @@ Zotero.CollectionTreeRow.prototype.setSearch = function (searchText, mode = null
|
|||
// has to trigger a re-run -- as does changing the similarity top-K, which
|
||||
// lives in its own pref. With no search text, neither matters.
|
||||
let effectiveMode = mode || Zotero.Prefs.get('search.quicksearch-mode');
|
||||
let topK = effectiveMode === 'similarity'
|
||||
let topK = effectiveMode === 'bestMatch'
|
||||
? Zotero.Prefs.get('search.quicksearch-semantic-topK')
|
||||
: null;
|
||||
if (this.searchText === searchText
|
||||
|
|
@ -724,9 +724,9 @@ Zotero.CollectionTreeRow.prototype.isSearchMode = function () {
|
|||
* Whether an active quick search on this row is in the semantic similarity
|
||||
* mode -- i.e. the results are a ranked top-K set rather than a plain filter
|
||||
*/
|
||||
Zotero.CollectionTreeRow.prototype.isSimilaritySearch = function () {
|
||||
Zotero.CollectionTreeRow.prototype.isBestMatchSearch = function () {
|
||||
return !!this.searchText && !this.advancedSearch
|
||||
&& (this.searchMode || Zotero.Prefs.get('search.quicksearch-mode')) === 'similarity';
|
||||
&& (this.searchMode || Zotero.Prefs.get('search.quicksearch-mode')) === 'bestMatch';
|
||||
};
|
||||
|
||||
Zotero.CollectionTreeRow.prototype.isSortable = function () {
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ quicksearch-input =
|
|||
.placeholder = { $placeholder }
|
||||
.aria-description = { $placeholder }
|
||||
quicksearch-semantic-topk =
|
||||
.aria-label = Number of similarity search results
|
||||
.aria-label = Number of best-match search results
|
||||
quickSearch-mode-similarity = Similarity
|
||||
|
||||
advanced-search = Advanced Search
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue