mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
remove filters, rename facet_filters to filter
This commit is contained in:
parent
77740829bd
commit
a717925caa
@ -33,9 +33,8 @@ pub struct SearchQuery {
|
||||
pub attributes_to_crop: Option<HashSet<String>>,
|
||||
pub crop_length: Option<usize>,
|
||||
pub attributes_to_highlight: Option<HashSet<String>>,
|
||||
pub filters: Option<String>,
|
||||
pub matches: Option<bool>,
|
||||
pub facet_filters: Option<Value>,
|
||||
pub filter: Option<Value>,
|
||||
pub facet_distributions: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
@ -75,8 +74,8 @@ impl Index {
|
||||
search.limit(query.limit);
|
||||
search.offset(query.offset.unwrap_or_default());
|
||||
|
||||
if let Some(ref facets) = query.facet_filters {
|
||||
if let Some(facets) = parse_facets(facets, self, &rtxn)? {
|
||||
if let Some(ref filter) = query.filter {
|
||||
if let Some(facets) = parse_facets(filter, self, &rtxn)? {
|
||||
search.facet_condition(facets);
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,8 @@ pub struct SearchQueryGet {
|
||||
attributes_to_crop: Option<String>,
|
||||
crop_length: Option<usize>,
|
||||
attributes_to_highlight: Option<String>,
|
||||
filters: Option<String>,
|
||||
filter: Option<String>,
|
||||
matches: Option<bool>,
|
||||
facet_filters: Option<String>,
|
||||
facet_distributions: Option<String>,
|
||||
}
|
||||
|
||||
@ -50,7 +49,7 @@ impl TryFrom<SearchQueryGet> for SearchQuery {
|
||||
.facet_distributions
|
||||
.map(|attrs| attrs.split(',').map(String::from).collect::<Vec<_>>());
|
||||
|
||||
let facet_filters = match other.facet_filters {
|
||||
let filter = match other.filter {
|
||||
Some(ref f) => Some(serde_json::from_str(f)?),
|
||||
None => None,
|
||||
};
|
||||
@ -63,9 +62,8 @@ impl TryFrom<SearchQueryGet> for SearchQuery {
|
||||
attributes_to_crop,
|
||||
crop_length: other.crop_length,
|
||||
attributes_to_highlight,
|
||||
filters: other.filters,
|
||||
filter,
|
||||
matches: other.matches,
|
||||
facet_filters,
|
||||
facet_distributions,
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user