Officially Supported Languages
ZBSearch supports 34 languages out of the box in 8 different alphabets. For every language, ZBSearch provides a default tokenizer, stop-words, and stemmer.
Right now, ZBSearch supports 34 languages out of the box in 8 different alphabets.
For every language, ZBSearch provides a default tokenizer, stop-words, and stemmer.
π¨π³π―π΅ A note on Chinese and Japanese
At the time of writing, Chinese (Mandarin) and Japanese are the only exception, since ZBSearch provides everything by default but the stemmer.
Since Chinese and Japanese logograms follow different rules than other alphabets, you will need to import a dedicated tokenizer for it.
Multilingual mode (zero-config)
If you don't know the language of your documents ahead of time - or a single index mixes several languages - use multilingual instead of a specific language:
import { create } from 'zbsearch'
const db = create({
schema: { title: 'string', content: 'string' },
language: 'multilingual'
})In this mode ZBSearch tokenizes with Intl.Segmenter (Unicode word segmentation, with a Unicode regex fallback on runtimes that lack it), so Latin, Cyrillic, Greek, Arabic, Hebrew, Indic, and CJK text all index correctly with no per-language setup. Tokens are lowercased, and diacritics are folded so that cafΓ© matches cafe, ΡΠ»ΠΊΠ° matches Π΅Π»ΠΊΠ°, and Ψ’ΩΨ§Ω matches Ψ§ΩΨ§Ω.
Trade-offs compared to a per-language configuration:
- No stemming and no stop-words by default. Queries for inflected forms (
runningvs.run) won't match unless you pass a customstemmerfunction. Per-language installs with@zbsearch/stemmersremain the quality ceiling for single-language content: in the quality benchmark that ships with the repo (benchmarks/,npm run benchmark:multilingual-quality), the multilingual mode reaches ~0.70 recall@10 vs ~0.98 for tuned per-language installs, with most of the gap on inflection queries - while non-Latin scripts go from 0 (English default) to fully searchable. - CJK segmentation is script-based, not dictionary-based. It works well with prefix search, but for production Japanese or Chinese search prefer the dedicated tokenizers.
- Sorting falls back to the runtime's default collation, since there is no single locale.
For multilingual sites (one locale per document), the recommended pattern is to keep a single multilingual index and store the locale as an enum, then filter at query time:
const db = create({
schema: { title: 'string', content: 'string', locale: 'enum' },
language: 'multilingual'
})
await search(db, { term: 'getting started', where: { locale: { eq: 'it' } } })Latin Alphabet
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Czech | β | β | β |
| Danish | β | β | β |
| Dutch | β | β | β |
| English | β | β | β |
| Finnish | β | β | β |
| French | β | β | β |
| German | β | β | β |
| Hungarian | β | β | β |
| Indonesian | β | β | β |
| Irish | β | β | β |
| Italian | β | β | β |
| Lithuanian | β | β | β |
| Norwegian | β | β | β |
| Portuguese | β | β | β |
| Romanian (*) | β | β | β |
| Serbian (**) | β | β | β |
| Slovak | β | β | β |
| Slovenian | β | β | β |
| Spanish | β | β | β |
| Swedish | β | β | β |
| Turkish | β | β | β |
| Vietnamese | β | β | β |
(*) = also uses a few additional diacritic marks
(**) = uses both Cyrillic and Latin scripts
Cyrillic Alphabet
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Bulgarian | β | β | β |
| Russian | β | β | β |
| Serbian (*) | β | β | β |
| Ukrainian | β | β | β |
(*) = uses both Cyrillic and Latin scripts
Greek Alphabet
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Greek | β | β | β |
Devanagari Script
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Hindi | β | β | β |
| Nepali | β | β | β |
| Sanskrit | β | β | β |
Arabic Script
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Arabic | β | β | β |
Armenian Alphabet
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Armenian | β | β | β |
Tamil Script
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Tamil | β | β | β |
Chinese Characters (Logographic Script)
| Language | Tokenizer | Stop-words | Stemmer |
|---|---|---|---|
| Chinese (Mandarin) | β | β | β |
| Japanese | β | β | β |