mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-06-15 04:21:36 +02:00
Remove the SearchQuery Default impl and change the From impl
This commit is contained in:
parent
c60d11fb42
commit
28e6adc435
@ -57,7 +57,7 @@ pub const DEFAULT_HIGHLIGHT_PRE_TAG: fn() -> String = || "<em>".to_string();
|
|||||||
pub const DEFAULT_HIGHLIGHT_POST_TAG: fn() -> String = || "</em>".to_string();
|
pub const DEFAULT_HIGHLIGHT_POST_TAG: fn() -> String = || "</em>".to_string();
|
||||||
pub const DEFAULT_SEMANTIC_RATIO: fn() -> SemanticRatio = || SemanticRatio(0.5);
|
pub const DEFAULT_SEMANTIC_RATIO: fn() -> SemanticRatio = || SemanticRatio(0.5);
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Deserr, ToSchema)]
|
#[derive(Clone, Default, PartialEq, Deserr, ToSchema)]
|
||||||
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
#[deserr(error = DeserrJsonError, rename_all = camelCase, deny_unknown_fields)]
|
||||||
pub struct SearchQuery {
|
pub struct SearchQuery {
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidSearchQ>)]
|
#[deserr(default, error = DeserrJsonError<InvalidSearchQ>)]
|
||||||
@ -145,19 +145,9 @@ impl From<SearchParameters> for SearchQuery {
|
|||||||
matching_strategy: matching_strategy.map(MatchingStrategy::from).unwrap_or_default(),
|
matching_strategy: matching_strategy.map(MatchingStrategy::from).unwrap_or_default(),
|
||||||
attributes_to_search_on,
|
attributes_to_search_on,
|
||||||
ranking_score_threshold: ranking_score_threshold.map(RankingScoreThreshold::from),
|
ranking_score_threshold: ranking_score_threshold.map(RankingScoreThreshold::from),
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for SearchQuery {
|
|
||||||
fn default() -> Self {
|
|
||||||
SearchQuery {
|
|
||||||
q: None,
|
q: None,
|
||||||
vector: None,
|
vector: None,
|
||||||
hybrid: None,
|
|
||||||
offset: DEFAULT_SEARCH_OFFSET(),
|
offset: DEFAULT_SEARCH_OFFSET(),
|
||||||
limit: DEFAULT_SEARCH_LIMIT(),
|
|
||||||
page: None,
|
page: None,
|
||||||
hits_per_page: None,
|
hits_per_page: None,
|
||||||
attributes_to_retrieve: None,
|
attributes_to_retrieve: None,
|
||||||
@ -169,15 +159,10 @@ impl Default for SearchQuery {
|
|||||||
show_ranking_score: false,
|
show_ranking_score: false,
|
||||||
show_ranking_score_details: false,
|
show_ranking_score_details: false,
|
||||||
filter: None,
|
filter: None,
|
||||||
sort: None,
|
|
||||||
distinct: None,
|
|
||||||
facets: None,
|
facets: None,
|
||||||
highlight_pre_tag: DEFAULT_HIGHLIGHT_PRE_TAG(),
|
highlight_pre_tag: DEFAULT_HIGHLIGHT_PRE_TAG(),
|
||||||
highlight_post_tag: DEFAULT_HIGHLIGHT_POST_TAG(),
|
highlight_post_tag: DEFAULT_HIGHLIGHT_POST_TAG(),
|
||||||
crop_marker: DEFAULT_CROP_MARKER(),
|
crop_marker: DEFAULT_CROP_MARKER(),
|
||||||
matching_strategy: Default::default(),
|
|
||||||
attributes_to_search_on: None,
|
|
||||||
ranking_score_threshold: None,
|
|
||||||
locales: None,
|
locales: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user