Add a search example with `filter` in README
Closed this issue · 3 comments
Related to: meilisearch/integration-guides#136
In the README, we want to add the Custom Search With Filters
sub section in the Getting Started
section to make the users are aware of filtering.
This should
- be placed right after the
Custom Search
sub section - contain the following content:
---------- beginning of the content
If you want to enable filtering, you must add your attributes to the filterableAttributes
index setting.
--- Add an example corresponding to the current repository. See this example in JS:
await index.updateAttributesForFaceting([
'id',
'genres'
])
--- end of example
You only need to perform this operation once.
Note that MeiliSearch will rebuild your index whenever you update filterableAttributes
. Depending on the size of your dataset, this might take time. You can track the process using the update status.
Then, you can perform the search:
--- Add an example corresponding to the current repository. See this example in JS:
await index.search(
'wonder',
{
filter: ['id > 1 AND genres = Action']
}
)
--- end of example
{
"hits": [
{
"id": 2,
"title": "Wonder Woman",
"genres": ["Action","Adventure"]
}
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"processingTimeMs": 0,
"query": "wonder"
}
------------- end of the content
📣 Example of PR: https://github.com/meilisearch/meilisearch-js/pull/1059/files
Hi, can i take up this issue
Hello @ginglis13
Thanks for your interest in this project :)
FYI, we prefer not assigning people to our issues because sometimes people ask to be assigned and never come back, which discourages the volunteer contributors to open a PR to fix this issue.
We will accept and merge the first PR that fixes correctly and well implements the issue following our contributing guidelines.
We are looking forward to reviewing your PR 🙂
Understandable 😁 I'll get started on it