Configure index settings
Suppose you have a collection of movies calledmovie_ratings containing the following fields:
filterableAttributes list:
filterableAttributes requires Meilisearch to re-index all your data, which will take an amount of time proportionate to your dataset size and complexity.
By default,
filterableAttributes is empty. Filters do not work without first explicitly adding attributes to the filterableAttributes list.Use filter when searching
After updating the filterableAttributes index setting, you can use filter to fine-tune your search results.
filter is a search parameter you may use at search time. filter accepts filter expressions built using any attributes present in the filterableAttributes list.
The following code sample returns Avengers movies released after 18 March 1995:
Batman movies directed by either Tim Burton or Christopher Nolan:
Tim Burton and released after 1995 or any film directed by Christopher Nolan, without constraints on its release date. This happens because AND takes precedence over OR.
If you only want recent Planet of the Apes movies that weren’t directed by Tim Burton, you can use this filter: