mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Bump serde-cs to simplify our usage of the star_or function
This commit is contained in:
parent
64b5b2e1f8
commit
277a0a7967
5 changed files with 13 additions and 32 deletions
|
@ -50,23 +50,6 @@ pub struct SearchQueryGet {
|
|||
|
||||
impl From<SearchQueryGet> for SearchQuery {
|
||||
fn from(other: SearchQueryGet) -> Self {
|
||||
let attributes_to_retrieve = other
|
||||
.attributes_to_retrieve
|
||||
.map(CS::into_inner)
|
||||
.and_then(fold_star_or);
|
||||
|
||||
let attributes_to_crop = other
|
||||
.attributes_to_crop
|
||||
.map(CS::into_inner)
|
||||
.and_then(fold_star_or);
|
||||
|
||||
let attributes_to_highlight = other
|
||||
.attributes_to_highlight
|
||||
.map(CS::into_inner)
|
||||
.and_then(fold_star_or);
|
||||
|
||||
let facets = other.facets.map(CS::into_inner).and_then(fold_star_or);
|
||||
|
||||
let filter = match other.filter {
|
||||
Some(f) => match serde_json::from_str(&f) {
|
||||
Ok(v) => Some(v),
|
||||
|
@ -75,20 +58,18 @@ impl From<SearchQueryGet> for SearchQuery {
|
|||
None => None,
|
||||
};
|
||||
|
||||
let sort = other.sort.map(|attr| fix_sort_query_parameters(&attr));
|
||||
|
||||
Self {
|
||||
q: other.q,
|
||||
offset: other.offset,
|
||||
limit: other.limit.unwrap_or_else(DEFAULT_SEARCH_LIMIT),
|
||||
attributes_to_retrieve,
|
||||
attributes_to_crop,
|
||||
attributes_to_retrieve: other.attributes_to_retrieve.and_then(fold_star_or),
|
||||
attributes_to_crop: other.attributes_to_crop.and_then(fold_star_or),
|
||||
crop_length: other.crop_length,
|
||||
attributes_to_highlight,
|
||||
attributes_to_highlight: other.attributes_to_highlight.and_then(fold_star_or),
|
||||
filter,
|
||||
sort,
|
||||
sort: other.sort.map(|attr| fix_sort_query_parameters(&attr)),
|
||||
show_matches_position: other.show_matches_position,
|
||||
facets,
|
||||
facets: other.facets.and_then(fold_star_or),
|
||||
highlight_pre_tag: other.highlight_pre_tag,
|
||||
highlight_post_tag: other.highlight_post_tag,
|
||||
crop_marker: other.crop_marker,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue