Fix after rebase

This commit is contained in:
Clémentine Urquizar 2021-06-14 13:27:18 +02:00
parent 9996c59183
commit d4be4d80db
No known key found for this signature in database
GPG Key ID: D8E7CC7422E77E1A

View File

@ -74,15 +74,9 @@ impl Index {
search.limit(query.limit); search.limit(query.limit);
search.offset(query.offset.unwrap_or_default()); search.offset(query.offset.unwrap_or_default());
<<<<<<< HEAD
if let Some(ref filter) = query.filter { if let Some(ref filter) = query.filter {
if let Some(facets) = parse_facets(filter, self, &rtxn)? { if let Some(facets) = parse_facets(filter, self, &rtxn)? {
search.facet_condition(facets);
=======
if let Some(ref facets) = query.facet_filters {
if let Some(facets) = parse_facets(facets, self, &rtxn)? {
search.filter(facets); search.filter(facets);
>>>>>>> 562cc32 (Add changes according to milli update)
} }
} }
@ -282,38 +276,6 @@ impl Matcher for MatchingWords {
} }
} }
<<<<<<< HEAD
=======
fn parse_facets_array(
txn: &RoTxn,
index: &Index,
arr: &[Value],
) -> anyhow::Result<Option<FilterCondition>> {
let mut ands = Vec::new();
for value in arr {
match value {
Value::String(s) => ands.push(Either::Right(s.clone())),
Value::Array(arr) => {
let mut ors = Vec::new();
for value in arr {
match value {
Value::String(s) => ors.push(s.clone()),
v => bail!("Invalid facet expression, expected String, found: {:?}", v),
}
}
ands.push(Either::Left(ors));
}
v => bail!(
"Invalid facet expression, expected String or [String], found: {:?}",
v
),
}
}
FilterCondition::from_array(txn, &index.0, ands)
}
>>>>>>> 562cc32 (Add changes according to milli update)
struct Highlighter<'a, A> { struct Highlighter<'a, A> {
analyzer: Analyzer<'a, A>, analyzer: Analyzer<'a, A>,
marks: (String, String), marks: (String, String),
@ -375,7 +337,7 @@ fn parse_facets(
txn: &RoTxn, txn: &RoTxn,
) -> anyhow::Result<Option<FilterCondition>> { ) -> anyhow::Result<Option<FilterCondition>> {
match facets { match facets {
Value::String(expr) => Ok(Some(FacetCondition::from_str(txn, index, expr)?)), Value::String(expr) => Ok(Some(FilterCondition::from_str(txn, index, expr)?)),
Value::Array(arr) => parse_facets_array(txn, index, arr), Value::Array(arr) => parse_facets_array(txn, index, arr),
v => bail!("Invalid facet expression, expected Array, found: {:?}", v), v => bail!("Invalid facet expression, expected Array, found: {:?}", v),
} }
@ -385,7 +347,7 @@ fn parse_facets_array(
txn: &RoTxn, txn: &RoTxn,
index: &Index, index: &Index,
arr: &[Value], arr: &[Value],
) -> anyhow::Result<Option<FacetCondition>> { ) -> anyhow::Result<Option<FilterCondition>> {
let mut ands = Vec::new(); let mut ands = Vec::new();
for value in arr { for value in arr {
match value { match value {
@ -407,7 +369,7 @@ fn parse_facets_array(
} }
} }
FacetCondition::from_array(txn, &index.0, ands) FilterCondition::from_array(txn, &index.0, ands)
} }
#[cfg(test)] #[cfg(test)]