Languages
Text in each of your app’s languages is analyzed with that language’s rules: plurals and other forms of a word match each other (“chevaux” finds “cheval”), spelling variants fold together, stop words are left out of queries, and languages written without spaces between words are split into words. This page covers which languages an app has, how a search picks among them, and how to tune each language with the dictionaries.
Every setting here is in the dashboard under Relevance → Languages, and the dictionaries on the Dictionaries page.
Index languages
Section titled “Index languages”indexLanguages are the languages your records are in, up to 6. Every
searchable field is analyzed in each of them, so an index language costs index
space: list the languages you have records in, not every one you might.
PATCH /v1/apps/my-store/settings{ "indexLanguages": ["ar", "en", "fr"] }New apps have English (["en"]). Add the others under Relevance → Languages
in the dashboard, or with indexLanguages as above. Records in another language are still found, with case, accents
and letter forms ignored and by meaning in semantic search, but without their
language’s plurals, stop words and word splitting until you add it.
Records say which language they’re in with
lang. A record without one is
labelled with the language its text is in, among all 39, so an Arabic record
on an English app is labelled ar and an Arabic search finds it. Short Latin
text with nothing to tell English, French or Spanish apart (a product name) is
labelled with one of the app’s index languages.
Declare your site’s languages
Section titled “Declare your site’s languages”A site can declare the languages its content is in. Those the app doesn’t index
yet are added, as many as fit (6 in all), which rebuilds the index; languages
are never removed this way. Codes can be as your site sends them (ar,
fr_FR, pt-BR):
POST /v1/apps/my-store/languages{ "languages": ["en", "ar", "fr_FR"] }The reply has the settings, the languages added, and those skipped
(unsupported, or past the limit). Declare them before you send records in
a new language, so the index analyzes them. With the JavaScript client, it’s admin.declareLanguages(["en", "ar"]).
Other changes to the languages are yours to make, in the settings or the
dashboard.
Supported languages
Section titled “Supported languages”| Code | Language | Plurals | Stop words | Notes |
|---|---|---|---|---|
ar |
Arabic | ✓ | ✓ | Letter variants, tashkeel and the article fold (see Arabic). |
bg |
Bulgarian | ✓ | ✓ | |
bn |
Bengali | ✓ | ✓ | |
ca |
Catalan | ✓ | ✓ | Elision (l’, d’). |
ckb |
Kurdish (Sorani) | ✓ | ✓ | |
cs |
Czech | ✓ | ✓ | |
da |
Danish | ✓ | ✓ | Compound words. |
de |
German | ✓ | ✓ | Compound words; ä, ö, ü and ß fold. |
el |
Greek | ✓ | ✓ | |
en |
English | ✓ | ✓ | Possessives (’s). |
es |
Spanish | ✓ | ✓ | |
et |
Estonian | ✓ | ✓ | |
eu |
Basque | ✓ | ✓ | |
fa |
Persian | ✓ | ✓ | Zero-width non-joiner (کتابها). |
fi |
Finnish | ✓ | ✓ | Compound words. |
fr |
French | ✓ | ✓ | Elision (l’, qu’). |
ga |
Irish | ✓ | ||
gl |
Galician | ✓ | ✓ | |
he |
Hebrew | |||
hi |
Hindi | ✓ | ✓ | |
hu |
Hungarian | ✓ | ✓ | |
hy |
Armenian | ✓ | ✓ | |
id |
Indonesian | ✓ | ✓ | |
it |
Italian | ✓ | ✓ | Elision (l’, dell’). |
ja |
Japanese | Split into words. | ||
ko |
Korean | Split into words. | ||
lt |
Lithuanian | ✓ | ✓ | |
lv |
Latvian | ✓ | ✓ | |
nl |
Dutch | ✓ | ✓ | Compound words. |
no |
Norwegian | ✓ | ✓ | Compound words. |
pt |
Portuguese | ✓ | ✓ | |
ro |
Romanian | ✓ | ✓ | |
ru |
Russian | ✓ | ✓ | |
sr |
Serbian | ✓ | ✓ | Cyrillic and Latin fold together. |
sv |
Swedish | ✓ | ✓ | Compound words. |
th |
Thai | ✓ | Split into words. | |
tr |
Turkish | ✓ | ✓ | Dotted and dotless i; apostrophes (İstanbul’da). |
ur |
Urdu | |||
zh |
Chinese | Split into words. |
GET /v1/apps/{appId}/languages lists them with what each supports.
Changing them rebuilds the index
Section titled “Changing them rebuilds the index”The index languages, the compounds dictionary, built-in stop words taken off in the stop words dictionary and the normalization are part of how the index is built. When you change one, Shoof AI rebuilds the index by itself:
- A new index is created with the new analysis, and the live one is copied into it. Embeddings are copied too, so nothing is embedded again.
- Meanwhile searches keep using the live index, and records you send go to both.
- When the copy is done, the new index takes over. Nothing needs sending again.
How long a rebuild takes depends on how many records there are. GET /settings shows it
under index.rebuild, and the dashboard shows its progress; index.languages
are the languages the live index has, which searches use until the rebuild is
done. A full sync started during a rebuild carries on in the
rebuilt index.
Query languages
Section titled “Query languages”A search matches its query in the index languages, each weighted by the
alphabet the query is typed in: a Latin query counts English and French in
full and Arabic a little (Latin brand names in Arabic records still match), and
when the search names its lang, other languages in the same alphabet count
half.
queryLanguages narrows the languages a query is matched in, for the app or
for one search. Leave it empty for all the index languages.
POST /v1/apps/my-store/search{ "q": "chevaux", "lang": "fr", "queryLanguages": ["fr"] }Every search parameter below also works on GET /search
(queryLanguages=fr,en, ignorePlurals=fr), and on facet value search.
| Parameter | Does |
|---|---|
queryLanguages |
The index languages to match in. |
ignorePlurals |
true, false or a list of languages: see Plurals. |
removeStopWords |
true, false or a list of languages: see Stop words. |
decompoundQuery |
false matches compound words in the query as one word. |
naturalLanguages |
A shorthand: these query languages, with plurals and stop words on for them. |
lang still decides which records a search returns (filterByLang).
Plurals
Section titled “Plurals”With ignorePlurals on, a word matches its plurals and other forms: “shoes”
finds “shoe”, “chevaux” finds “cheval”, “کتابها” finds “کتاب”. It’s on for every
language by default; set it to a list of languages for only those, or false
to match words only as they’re written.
Plurals come from each language’s stemmer, which knows the regular forms. Irregular ones, such as Arabic broken plurals (كتب for كتاب), go in the plurals dictionary.
Stop words
Section titled “Stop words”With removeStopWords on, words like “the”, “pour” and “في” are left out of the
query where it’s matched in their language, so “sac pour la randonnée” finds
“Sac randonnée”. A query of stop words alone is kept as it is. It’s on for every
language by default.
Compound words
Section titled “Compound words”German, Dutch, Swedish, Danish, Norwegian and Finnish write compound words as
one: “Kopfschmerztabletten” (headache tablets). Words in the compounds
dictionary are split into their parts in records and queries,
so “Tabletten” finds “Kopfschmerztabletten”, and “Kopfschmerztabletten” also
finds “Tabletten gegen Kopfschmerz”. decompoundQuery: false stops queries
being split. Changing the compounds dictionary rebuilds the index.
Languages without spaces
Section titled “Languages without spaces”Chinese, Japanese and Korean are matched in pairs of characters, and Thai is split into words, once they’re index languages. Without Thai, “ผู้หญิง” doesn’t find “รองเท้าวิ่งผู้หญิง”, where it’s written without spaces.
Normalization
Section titled “Normalization”Case, accents, Arabic letter forms, tashkeel and tatweel are ignored in every language, so “Café” matches “cafe” and أحذية matches احذية. Two settings change that, and rebuild the index:
| Setting | Does |
|---|---|
keepDiacriticsOnCharacters |
Lowercase letters whose diacritics are kept, such as "éü": “café” then no longer matches “cafe”. |
customNormalization |
Characters replaced before anything else, one character to one or two: {"ä": "ae"} makes “Baer” find “Bär”. Algolia’s form, {"default": {...}}, is accepted too. |
Dictionaries
Section titled “Dictionaries”Each language’s stop words, plurals and compound words can be changed. Added stop words and plurals apply at once. Compound words, and built-in stop words taken off (or a whole built-in list), rebuild the index: built-in stop words aren’t indexed in the language’s analysis.
PUT /v1/apps/my-store/dictionaries/stopWords{ "fr": { "add": ["svp"], "remove": ["pour"], "disableStandard": false } }
PUT /v1/apps/my-store/dictionaries/plurals{ "ar": [["كتاب", "كتب"], ["رجل", "رجال"]] }
PUT /v1/apps/my-store/dictionaries/compounds{ "de": [{ "word": "kopfschmerztabletten", "decomposition": ["kopfschmerz", "tabletten"] }] }| Dictionary | Entries | Limit |
|---|---|---|
stopWords |
Per language: words to add, built-in words to remove, and disableStandard to keep only yours. |
1,000 words each |
plurals |
Per language: sets of 2 to 20 forms that match each other. | 5,000 sets |
compounds |
Per language with compound words: a word and its 2 to 10 parts. |
5,000 words |
PUT /dictionaries/{name} replaces that dictionary in every language;
GET /dictionaries returns all three, and
GET /languages/{code}/stop-words a language’s built-in stop words. The
dictionaries are also in the settings as dictionaries; saving the settings
without them keeps them.