mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-12 16:08:55 +01:00
Further reduce an async block
This commit is contained in:
parent
add2ceef67
commit
1575456594
@ -46,8 +46,7 @@ pub async fn multi_search_with_post(
|
|||||||
// Explicitly expect a `(ResponseError, usize)` for the error type rather than `ResponseError` only,
|
// Explicitly expect a `(ResponseError, usize)` for the error type rather than `ResponseError` only,
|
||||||
// so that `?` doesn't work if it doesn't use `with_index`, ensuring that it is not forgotten in case of code
|
// so that `?` doesn't work if it doesn't use `with_index`, ensuring that it is not forgotten in case of code
|
||||||
// changes.
|
// changes.
|
||||||
let search_results: Result<_, (ResponseError, usize)> = {
|
let search_results: Result<_, (ResponseError, usize)> = async {
|
||||||
async {
|
|
||||||
let mut search_results = Vec::with_capacity(queries.len());
|
let mut search_results = Vec::with_capacity(queries.len());
|
||||||
for (query_index, (index_uid, mut query)) in
|
for (query_index, (index_uid, mut query)) in
|
||||||
queries.into_iter().map(SearchQueryWithIndex::into_index_query).enumerate()
|
queries.into_iter().map(SearchQueryWithIndex::into_index_query).enumerate()
|
||||||
@ -59,8 +58,7 @@ pub async fn multi_search_with_post(
|
|||||||
return Err(AuthenticationError::InvalidToken).with_index(query_index);
|
return Err(AuthenticationError::InvalidToken).with_index(query_index);
|
||||||
}
|
}
|
||||||
// Apply search rules from tenant token
|
// Apply search rules from tenant token
|
||||||
if let Some(search_rules) =
|
if let Some(search_rules) = index_scheduler.filters().get_index_search_rules(&index_uid)
|
||||||
index_scheduler.filters().get_index_search_rules(&index_uid)
|
|
||||||
{
|
{
|
||||||
add_search_rules(&mut query, search_rules);
|
add_search_rules(&mut query, search_rules);
|
||||||
}
|
}
|
||||||
@ -88,7 +86,6 @@ pub async fn multi_search_with_post(
|
|||||||
}
|
}
|
||||||
Ok(search_results)
|
Ok(search_results)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
if search_results.is_ok() {
|
if search_results.is_ok() {
|
||||||
|
Loading…
Reference in New Issue
Block a user