diff --git a/src/updater.rs b/src/updater.rs index 0207a9a..a6dfc87 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -46,6 +46,24 @@ where let index = meili_client.index(T::get_index()); + if let Err(err) = index + .set_searchable_attributes(T::get_searchable_attributes()) + .await + { + return Err(Box::new(err)); + }; + + if let Err(err) = index + .set_filterable_attributes(T::get_filterable_attributes()) + .await + { + return Err(Box::new(err)); + }; + + if let Err(err) = index.set_ranking_rules(T::get_ranking_rules()).await { + return Err(Box::new(err)); + }; + let params: Vec = vec![]; let stream = match client.query_raw(&T::get_query(), params).await { Ok(stream) => stream, @@ -69,24 +87,6 @@ where }; } - if let Err(err) = index - .set_searchable_attributes(T::get_searchable_attributes()) - .await - { - return Err(Box::new(err)); - }; - - if let Err(err) = index - .set_filterable_attributes(T::get_filterable_attributes()) - .await - { - return Err(Box::new(err)); - }; - - if let Err(err) = index.set_ranking_rules(T::get_ranking_rules()).await { - return Err(Box::new(err)); - }; - Ok(()) }