We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 870dc88 commit abe720cCopy full SHA for abe720c
docusaurus-search-local/src/client/utils/smartQueries.ts
@@ -81,6 +81,17 @@ export function smartQueries(
81
refinedTerms = terms.slice();
82
}
83
84
+ const MAX_TERMS = 10;
85
+ if (refinedTerms.length > MAX_TERMS) {
86
+ // Sort terms by length in ascending order.,
87
+ // And keep the top 10 terms.
88
+ refinedTerms.sort((a, b) => a.length - b.length);
89
+ refinedTerms.splice(MAX_TERMS, refinedTerms.length - MAX_TERMS);
90
+
91
+ terms.sort((a, b) => a.length - b.length);
92
+ terms.splice(MAX_TERMS, terms.length - MAX_TERMS);
93
+ }
94
95
// Also try to add extra terms which miss one of the searched tokens,
96
// when the term contains 3 or more tokens,
97
// to improve the search precision.
0 commit comments