A search cutoff is being introduced into Meilisearch; its purpose is to stop search requests when they’re taking too much time.

When a search is cut, only the relevancy is degraded. The filters are applied, and the documents are highlighted as usual.

Also, specifying a search cutoff of 150ms doesn’t mean that all search requests will stop after exactly 150ms. Some parts of the pipeline can not be stopped. This limitation only applies to the main algorithm of the search request, and then the rest of the computations can still go above your defined value.

API changes

Describe routes and behavior changes

Customize the search cutoff

A new setting will be introduced to customize the number of milliseconds to wait before stopping a search.

The default value is null, which is equivalent to 1500ms (1.5s) for the engine.

curl \\
  -X PATCH '<http://localhost:7700/indexes/movies/settings>' \\
  -H 'Content-Type: application/json' \\
  --data-binary '{
    "searchCutoffMs": 50
  }'
curl \\
  -X PUT '<http://localhost:7700/indexes/movies/settings/search-cutoff-ms>' \\
  -H 'Content-Type: application/json' \\
  --data-binary '50'

You can also reset the value to default by sending a DELETE request:

curl \\
  -X DELETE '<http://localhost:7700/indexes/movies/settings/search-cutoff-ms>'

And finally, you can query the value currently used by the engine by sending a GET request:

curl \\
  -X GET '<http://localhost:7700/indexes/movies/settings/search-cutoff-ms>'

Ranking score details

When a search is cut, it’ll appear in the ranking score details with a skipped rule.