diff --git a/apps/server/src/services/search/services/search.ts b/apps/server/src/services/search/services/search.ts index f9581aa170..ea1d20c263 100644 --- a/apps/server/src/services/search/services/search.ts +++ b/apps/server/src/services/search/services/search.ts @@ -236,12 +236,6 @@ 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) { @@ -415,6 +409,12 @@ function findResultsWithQuery(query: string, searchContext: SearchContext): Sear query = query || ""; searchContext.originalQuery = query; + // For autocomplete searches, use the dedicated autocomplete fuzzy option + // instead of the global fuzzy setting. Do this early so it applies to all code paths. + if (searchContext.autocomplete) { + searchContext.enableFuzzyMatching = optionService.getOptionBool("searchAutocompleteFuzzy"); + } + const expression = parseQueryToExpression(query, searchContext); if (!expression) {