-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Describe the bug
If typo tolerance is turned off for an attribute, searching for an exact value fails to yield any results.
To Reproduce
- Stand-up a meilisearch docker instance.
version: "3.8"
services:
meilisearch:
image: getmeili/meilisearch:v1.12
container_name: meilisearch
ports:
- "7701:7700"
environment:
MEILI_NO_ANALYTICS: "true"
MEILI_ENV: "development"
volumes:
- meili_data:/meili_data
volumes:
meili_data:
- Delete index (sanity check).
curl --location --request DELETE 'http://localhost:7701/indexes/widgets'
- Create index.
curl --location 'http://localhost:7701/indexes' \
--header 'Content-Type: application/json' \
--data '{
"uid": "widgets",
"primaryKey": "id"
}'
- Update searchable attributes.
curl --location --request PUT 'http://localhost:7701/indexes/widgets/settings/searchable-attributes' \
--header 'Content-Type: application/json' \
--data '[
"serialNumber",
"name"
]'
- Turn off typo tolerance on "serialNumber" attribute
curl --location --request PATCH 'http://localhost:7701/indexes/widgets/settings/typo-tolerance' \
--header 'Content-Type: application/json' \
--data '{
"disableOnAttributes": ["serialNumber"]
}'
- Create 3 documents
curl --location 'http://localhost:7701/indexes/widgets/documents' \
--header 'Content-Type: application/json' \
--data '[
{
"id": 287947,
"serialNumber": "SN1234",
"name": "WIDGET ALPHA"
},
{
"id": 287948,
"serialNumber": "SN1235",
"name": "WIDGET BETA"
},
{
"id": 287949,
"serialNumber": "SN1236",
"name": "WIDGET GAMMA"
}
]'
- Get documents, no query or filter values.
curl --location 'http://localhost:7701/indexes/widgets/search' \
--header 'Content-Type: application/json' \
--data '{
"q": "",
"offset": 0,
"limit": 10
}'

- [FAILS] Query for document using exact serialNumber value. Nothing is returned.
curl --location 'http://localhost:7701/indexes/widgets/search' \
--header 'Content-Type: application/json' \
--data '{
"q": "SN1234",
"offset": 0,
"limit": 10
}'

Additional notes
If the above reproduction steps are completed, but steps 5 and 6 have their order swapped, the issue cannot be seen.
Expected behavior
Attributes with typo tolerance turned off should be returned from search endpoint when exact match is provided in query.
Screenshots
See above.
Meilisearch version:
v1.12
Metadata
Metadata
Assignees
Labels
No labels