Skip to content

Commit d66c82a

Browse files
committed
[docs] Use correct language for orama search
1 parent 2747429 commit d66c82a

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

‎docs/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
},
1414
"dependencies": {
1515
"@orama/orama": "^3.1.18",
16+
"@orama/stopwords": "^3.1.18",
17+
"@orama/tokenizers": "^3.1.18",
1618
"@radix-ui/react-accordion": "^1.2.17",
1719
"class-variance-authority": "^0.7.1",
1820
"fumadocs-core": "^16.11.5",

‎docs/src/app/api/search/route.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import { stopwords as mandarinStopwords } from '@orama/stopwords/mandarin';
2+
import { createTokenizer } from '@orama/tokenizers/mandarin';
13
import { createFromSource } from 'fumadocs-core/search/server';
24

35
import { source } from '@/lib/source';
46

57
export const revalidate = false;
68

79
export const { staticGET: GET } = createFromSource(source, {
8-
// https://docs.orama.com/docs/orama-js/supported-languages
9-
language: 'english',
10+
components: {
11+
tokenizer: createTokenizer({
12+
language: 'mandarin',
13+
stopWords: mandarinStopwords,
14+
}),
15+
},
1016
});

‎docs/src/components/search.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use client';
22
import { create } from '@orama/orama';
3+
import { stopwords as mandarinStopwords } from '@orama/stopwords/mandarin';
4+
import { createTokenizer } from '@orama/tokenizers/mandarin';
35
import { useDocsSearch } from 'fumadocs-core/search/client';
46
import {
57
SearchDialog,
@@ -17,8 +19,12 @@ import { useI18n } from 'fumadocs-ui/contexts/i18n';
1719
function initOrama() {
1820
return create({
1921
schema: { _: 'string' },
20-
// https://docs.orama.com/docs/orama-js/supported-languages
21-
language: 'english',
22+
components: {
23+
tokenizer: createTokenizer({
24+
language: 'mandarin',
25+
stopWords: mandarinStopwords,
26+
}),
27+
},
2228
});
2329
}
2430

‎pnpm-lock.yaml‎

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)