mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-29 18:04:47 +00:00
Merge remote-tracking branch 'origin/main' into facet-levels-refactor
This commit is contained in:
@ -69,7 +69,7 @@ impl<'a> FacetDistribution<'a> {
|
||||
) -> heed::Result<()> {
|
||||
match facet_type {
|
||||
FacetType::Number => {
|
||||
let mut key_buffer: Vec<_> = field_id.to_be_bytes().iter().copied().collect();
|
||||
let mut key_buffer: Vec<_> = field_id.to_be_bytes().to_vec();
|
||||
|
||||
let distribution_prelength = distribution.len();
|
||||
let db = self.index.field_id_docid_facet_f64s;
|
||||
@ -94,7 +94,7 @@ impl<'a> FacetDistribution<'a> {
|
||||
}
|
||||
FacetType::String => {
|
||||
let mut normalized_distribution = BTreeMap::new();
|
||||
let mut key_buffer: Vec<_> = field_id.to_be_bytes().iter().copied().collect();
|
||||
let mut key_buffer: Vec<_> = field_id.to_be_bytes().to_vec();
|
||||
|
||||
let db = self.index.field_id_docid_facet_strings;
|
||||
'outer: for docid in candidates.into_iter() {
|
||||
|
@ -95,7 +95,7 @@ impl<'a> Filter<'a> {
|
||||
Either::Left(array) => {
|
||||
let mut ors = vec![];
|
||||
for rule in array {
|
||||
if let Some(filter) = Self::from_str(rule.as_ref())? {
|
||||
if let Some(filter) = Self::from_str(rule)? {
|
||||
ors.push(filter.condition);
|
||||
}
|
||||
}
|
||||
@ -107,7 +107,7 @@ impl<'a> Filter<'a> {
|
||||
}
|
||||
}
|
||||
Either::Right(rule) => {
|
||||
if let Some(filter) = Self::from_str(rule.as_ref())? {
|
||||
if let Some(filter) = Self::from_str(rule)? {
|
||||
ands.push(filter.condition);
|
||||
}
|
||||
}
|
||||
@ -300,7 +300,7 @@ impl<'a> Filter<'a> {
|
||||
index,
|
||||
filterable_fields,
|
||||
)?;
|
||||
return Ok(all_ids - selected);
|
||||
Ok(all_ids - selected)
|
||||
}
|
||||
FilterCondition::In { fid, els } => {
|
||||
if crate::is_faceted(fid.value(), filterable_fields) {
|
||||
@ -319,38 +319,36 @@ impl<'a> Filter<'a> {
|
||||
Ok(RoaringBitmap::new())
|
||||
}
|
||||
} else {
|
||||
return Err(fid.as_external_error(FilterError::AttributeNotFilterable {
|
||||
Err(fid.as_external_error(FilterError::AttributeNotFilterable {
|
||||
attribute: fid.value(),
|
||||
filterable_fields: filterable_fields.clone(),
|
||||
}))?;
|
||||
}))?
|
||||
}
|
||||
}
|
||||
FilterCondition::Condition { fid, op } => {
|
||||
if crate::is_faceted(fid.value(), filterable_fields) {
|
||||
let field_ids_map = index.fields_ids_map(rtxn)?;
|
||||
if let Some(fid) = field_ids_map.id(fid.value()) {
|
||||
Self::evaluate_operator(rtxn, index, fid, &op)
|
||||
Self::evaluate_operator(rtxn, index, fid, op)
|
||||
} else {
|
||||
return Ok(RoaringBitmap::new());
|
||||
Ok(RoaringBitmap::new())
|
||||
}
|
||||
} else {
|
||||
match fid.lexeme() {
|
||||
attribute @ "_geo" => {
|
||||
return Err(fid.as_external_error(FilterError::BadGeo(attribute)))?;
|
||||
Err(fid.as_external_error(FilterError::BadGeo(attribute)))?
|
||||
}
|
||||
attribute if attribute.starts_with("_geoPoint(") => {
|
||||
return Err(fid.as_external_error(FilterError::BadGeo("_geoPoint")))?;
|
||||
Err(fid.as_external_error(FilterError::BadGeo("_geoPoint")))?
|
||||
}
|
||||
attribute @ "_geoDistance" => {
|
||||
return Err(fid.as_external_error(FilterError::Reserved(attribute)))?;
|
||||
Err(fid.as_external_error(FilterError::Reserved(attribute)))?
|
||||
}
|
||||
attribute => {
|
||||
return Err(fid.as_external_error(
|
||||
FilterError::AttributeNotFilterable {
|
||||
attribute,
|
||||
filterable_fields: filterable_fields.clone(),
|
||||
},
|
||||
))?;
|
||||
Err(fid.as_external_error(FilterError::AttributeNotFilterable {
|
||||
attribute,
|
||||
filterable_fields: filterable_fields.clone(),
|
||||
}))?
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -419,10 +417,10 @@ impl<'a> Filter<'a> {
|
||||
|
||||
Ok(result)
|
||||
} else {
|
||||
return Err(point[0].as_external_error(FilterError::AttributeNotFilterable {
|
||||
Err(point[0].as_external_error(FilterError::AttributeNotFilterable {
|
||||
attribute: "_geo",
|
||||
filterable_fields: filterable_fields.clone(),
|
||||
}))?;
|
||||
}))?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user