At the time of writing, Orama supports Japanese via a custom tokenizer, which is part of the @orama/tokenizers package.
@orama/tokenizers
To get started, make sure to install all the dependencies you need:
npm install @orama/orama @orama/tokenizers
yarn add @orama/orama @orama/tokenizers
pnpm install @orama/orama @orama/tokenizers
If you want to add Japanese stop-words as well, install the @orama/stopwords package too:
@orama/stopwords
npm install @orama/stopwords
yarn add @orama/stopwords
pnpm install @orama/stopwords
Now you’re ready to get started with Orama:
import { create, insert, search } from "@orama/orama";import { createTokenizer } from '@orama/tokenizers/japanese'import { stopwords as japaneseStopwords } from "@orama/stopwords/japanese"; const db = create({ schema: { name: "string", }, components: { tokenizer: createTokenizer({ stopWords: japaneseStopwords, }), },}); insert(db, { name: "東京" }); // Tokyoinsert(db, { name: "大阪" }); // Osakainsert(db, { name: "京都" }); // Kyotoinsert(db, { name: "横浜" }); // Yokohamainsert(db, { name: "札幌" }); // Sapporoinsert(db, { name: "仙台" }); // Sendaiinsert(db, { name: "広島" }); // Hiroshimainsert(db, { name: "東京大学" }); // University of Tokyoinsert(db, { name: "京都大学" }); // Kyoto Universityinsert(db, { name: "大阪大学" }); // Osaka University const results = search(db, { term: "大阪", threshold: 0,}); console.log(results); // {// "elapsed": {// "raw": 89554625,// "formatted": "89ms"// },// "hits": [// {// "id": "36666208-3",// "score": 4.210224897276653,// "document": {// "name": "大阪"// }// },// {// "id": "36666208-10",// "score": 1.9335268122510698,// "document": {// "name": "大阪大学"// }// }// ],// "count": 2// }