Skip to content

Replace a dictionary

PUT
/v1/apps/{appId}/dictionaries/{name}
curl --request PUT \
--url https://api.shoofai.com/v1/apps/demo-store/dictionaries/stopWords \
--header 'Content-Type: application/json' \
--header 'x-shoof-api-key: <x-shoof-api-key>' \
--data '{ "ar": [ [ "كتاب", "كتب" ] ] }'

Replaces one dictionary in every language: the body is the dictionary by language code. Stop words and plurals apply at once; compounds rebuild the index (index.rebuild).

appId
required
string

The app’s id, shown in the dashboard (for example ali-sport-goods). demo-store is the public demo app.

Example

demo-store
name
required
string
Allowed values: stopWords plurals compounds
Media typeapplication/json
object

Example

{
"ar": [
[
"كتاب",
"كتب"
]
]
}

The dictionaries as saved, and the index’s state.

Media typeapplication/json
object
dictionaries

Per language code. See Dictionaries.

object
stopWords
object
key
additional properties
object
add
Array<string>
<= 1000 items
remove
Array<string>
<= 1000 items
disableStandard
boolean
plurals
object
key
additional properties
Array<Array<string>>
<= 5000 items
compounds
object
key
additional properties
Array<object>
<= 5000 items
object
word
required
string
decomposition
required
Array<string>
>= 2 items <= 10 items
index
object
languages

The languages the live index has.

Array<string>
Allowed values: ar bg bn ca ckb cs da de el en es et eu fa fi fr ga gl he hi hu hy id it ja ko lt lv nl no pt ro ru sr sv th tr ur zh
analysis

How the live index analyzes text.

object
rebuild

The new index being built, if one is.

object
kind
string
Allowed values: rebuild sync
startedAt
string format: date-time
languages
Array<string>
Allowed values: ar bg bn ca ckb cs da de el en es et eu fa fi fr ga gl he hi hu hy id it ja ko lt lv nl no pt ro ru sr sv th tr ur zh
copying
boolean
copied
integer
total
integer

Example

{
"dictionaries": {
"stopWords": {
"fr": {
"add": [
"svp"
],
"remove": [],
"disableStandard": false
}
},
"plurals": {
"ar": [
[
"كتاب",
"كتب"
]
]
},
"compounds": {
"de": [
{
"word": "kopfschmerztabletten",
"decomposition": [
"kopfschmerz",
"tabletten"
]
}
]
}
},
"index": {
"languages": [
"ar"
],
"rebuild": {
"kind": "rebuild",
"languages": [
"ar"
]
}
}
}

The request is invalid (bad_request). details lists each problem with its path.

Media typeapplication/json
object
error
required
object
code
required

A stable, machine-readable code.

string
message
required

A human-readable explanation.

string
details

More about the error, such as the validation problems.

Example

{
"error": {
"code": "bad_request",
"message": "Invalid request",
"details": [
{
"path": "hitsPerPage",
"message": "Must be 100 or less"
}
]
}
}

The record doesn’t exist (not_found).

Media typeapplication/json
object
error
required
object
code
required

A stable, machine-readable code.

string
message
required

A human-readable explanation.

string
details

More about the error, such as the validation problems.

Example generated

{
"error": {
"code": "example",
"message": "example",
"details": "example"
}
}