Skip to content

Commit fd637e3

Browse files
chore: prevent OOM with large doc set (#12)
* chore: prevent OOM with large doc set * fix: add missing comma and update stale JSDoc comment --------- Co-authored-by: Steve Calvert <steve.calvert@gmail.com>
1 parent a79eec5 commit fd637e3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/search/flexsearch-core.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ function englishStemmer(word: string): string {
5151
* Create a FlexSearch document index with enhanced configuration
5252
*
5353
* Features:
54-
* - Full substring matching (finds "auth" in "authentication")
54+
* - Forward-prefix tokenization (finds "auth" in "authentication", avoids OOM on large doc sets)
5555
* - English stemming (finds "authenticate" when searching "authentication")
5656
* - Context-aware scoring for phrase matching
5757
* - Optimized resolution for relevance ranking
5858
*/
5959
export function createSearchIndex(): FlexSearchDocument {
6060
return new FlexSearch.Document<IndexableDocument, string[]>({
61-
// Use 'full' tokenization for substring matching
62-
// This allows "auth" to match "authentication"
63-
tokenize: 'full',
61+
// Use 'forward' tokenization to avoid OOM with large doc sets
62+
// See: https://github.com/scalvert/docusaurus-plugin-mcp-server/issues/11
63+
tokenize: 'forward',
6464

6565
// Enable caching for faster repeated queries
6666
cache: 100,

0 commit comments

Comments
 (0)