mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 10:15:33 +02:00
refactor(search): simplify branching for autocomplete
This commit is contained in:
@@ -236,6 +236,12 @@ function findResultsWithExpression(expression: Expression, searchContext: Search
|
||||
loadNeededInfoFromDatabase();
|
||||
}
|
||||
|
||||
// For autocomplete searches, use the dedicated autocomplete fuzzy option
|
||||
// instead of the global fuzzy setting.
|
||||
if (searchContext.autocomplete) {
|
||||
searchContext.enableFuzzyMatching = optionService.getOptionBool("searchAutocompleteFuzzy");
|
||||
}
|
||||
|
||||
// If there's an explicit orderBy clause, skip progressive search
|
||||
// as it would interfere with the ordering
|
||||
if (searchContext.orderBy) {
|
||||
@@ -249,13 +255,6 @@ function findResultsWithExpression(expression: Expression, searchContext: Search
|
||||
return performSearch(expression, searchContext, false);
|
||||
}
|
||||
|
||||
// For autocomplete searches, use the dedicated autocomplete fuzzy option.
|
||||
// Default is off for faster response; users can enable if they want typo tolerance.
|
||||
if (searchContext.autocomplete) {
|
||||
const autocompleteFuzzy = optionService.getOptionBool("searchAutocompleteFuzzy");
|
||||
return performSearch(expression, searchContext, autocompleteFuzzy);
|
||||
}
|
||||
|
||||
// Phase 1: Try exact matches first (without fuzzy matching)
|
||||
const exactResults = performSearch(expression, searchContext, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user