mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-30 23:27:36 +01:00
Allow rebuilding a SearchQueryWithIndex from its components
This commit is contained in:
parent
3647c9d226
commit
481d890f53
@ -496,6 +496,72 @@ impl SearchQueryWithIndex {
|
|||||||
self.facets.as_deref().filter(|v| !v.is_empty())
|
self.facets.as_deref().filter(|v| !v.is_empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_index_query_federation(
|
||||||
|
index_uid: IndexUid,
|
||||||
|
query: SearchQuery,
|
||||||
|
federation_options: Option<FederationOptions>,
|
||||||
|
) -> Self {
|
||||||
|
let SearchQuery {
|
||||||
|
q,
|
||||||
|
vector,
|
||||||
|
hybrid,
|
||||||
|
offset,
|
||||||
|
limit,
|
||||||
|
page,
|
||||||
|
hits_per_page,
|
||||||
|
attributes_to_retrieve,
|
||||||
|
retrieve_vectors,
|
||||||
|
attributes_to_crop,
|
||||||
|
crop_length,
|
||||||
|
attributes_to_highlight,
|
||||||
|
show_matches_position,
|
||||||
|
show_ranking_score,
|
||||||
|
show_ranking_score_details,
|
||||||
|
filter,
|
||||||
|
sort,
|
||||||
|
distinct,
|
||||||
|
facets,
|
||||||
|
highlight_pre_tag,
|
||||||
|
highlight_post_tag,
|
||||||
|
crop_marker,
|
||||||
|
matching_strategy,
|
||||||
|
attributes_to_search_on,
|
||||||
|
ranking_score_threshold,
|
||||||
|
locales,
|
||||||
|
} = query;
|
||||||
|
|
||||||
|
SearchQueryWithIndex {
|
||||||
|
index_uid,
|
||||||
|
q,
|
||||||
|
vector,
|
||||||
|
hybrid,
|
||||||
|
offset: if offset == DEFAULT_SEARCH_OFFSET() { None } else { Some(offset) },
|
||||||
|
limit: if limit == DEFAULT_SEARCH_LIMIT() { None } else { Some(limit) },
|
||||||
|
page,
|
||||||
|
hits_per_page,
|
||||||
|
attributes_to_retrieve,
|
||||||
|
retrieve_vectors,
|
||||||
|
attributes_to_crop,
|
||||||
|
crop_length,
|
||||||
|
attributes_to_highlight,
|
||||||
|
show_ranking_score,
|
||||||
|
show_ranking_score_details,
|
||||||
|
show_matches_position,
|
||||||
|
filter,
|
||||||
|
sort,
|
||||||
|
distinct,
|
||||||
|
facets,
|
||||||
|
highlight_pre_tag,
|
||||||
|
highlight_post_tag,
|
||||||
|
crop_marker,
|
||||||
|
matching_strategy,
|
||||||
|
attributes_to_search_on,
|
||||||
|
ranking_score_threshold,
|
||||||
|
locales,
|
||||||
|
federation_options,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn into_index_query_federation(self) -> (IndexUid, SearchQuery, Option<FederationOptions>) {
|
pub fn into_index_query_federation(self) -> (IndexUid, SearchQuery, Option<FederationOptions>) {
|
||||||
let SearchQueryWithIndex {
|
let SearchQueryWithIndex {
|
||||||
index_uid,
|
index_uid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user