File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 8484//! [Movie{id: 1, title: String::from("Carol"), genres: vec!["Romance", "Drama"]}]
8585//! ```
8686//!
87+ //! #### Custom Search With Filters <!-- omit in TOC -->
88+ //!
89+ //! If you want to enable filtering, you must add your attributes to the `filterableAttributes`
90+ //! index setting.
91+ //!
92+ //! ```
93+ //! movies.set_filterable_attributes(["id", "genres"]).await.unwrap();
94+ //! ```
95+ //!
96+ //! You only need to perform this operation once.
97+ //!
98+ //! Note that MeiliSearch will rebuild your index whenever you update `filterableAttributes`.
99+ //! Depending on the size of your dataset, this might take time. You can track the whole process
100+ //! using the [update
101+ //! status](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status).
102+ //!
103+ //! Then, you can perform the search:
104+ //!
105+ //! ```
106+ //! println!("{:?}", movies.search().with_query("wonder").with_filter("id > 1 AND genres = Action")
107+ //! .execute::<Movie>().await.unwrap().hits);
108+ //! ```
109+ //!
110+ //! ```
111+ //! {
112+ //! "hits": [
113+ //! {
114+ //! "id": 2,
115+ //! "title": "Wonder Woman",
116+ //! "genres": ["Action", "Adventure"]
117+ //! }
118+ //! ],
119+ //! "offset": 0,
120+ //! "limit": 20,
121+ //! "nbHits": 1,
122+ //! "processingTimeMs": 0,
123+ //! "query": "wonder"
124+ //! }
125+ //! ```
126+ //!
87127//! ## 🌐 Running in the Browser with WASM <!-- omit in TOC -->
88128//!
89129//! This crate fully supports WASM.
You can’t perform that action at this time.
0 commit comments