mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Rewrite the CONTAINS filter with the MultiOps trait
This commit is contained in:
parent
d0ce1453a6
commit
50629cf735
@ -304,18 +304,19 @@ impl<'a> Filter<'a> {
|
|||||||
Condition::Contains(val) => {
|
Condition::Contains(val) => {
|
||||||
let finder = Finder::new(val.value());
|
let finder = Finder::new(val.value());
|
||||||
let base = FacetGroupKey { field_id, level: 0, left_bound: "" };
|
let base = FacetGroupKey { field_id, level: 0, left_bound: "" };
|
||||||
// TODO use the roaring::MultiOps trait
|
let docids = strings_db
|
||||||
let mut docids = RoaringBitmap::new();
|
|
||||||
for result in strings_db
|
|
||||||
.prefix_iter(rtxn, &base)?
|
.prefix_iter(rtxn, &base)?
|
||||||
.remap_data_type::<LazyDecode<FacetGroupValueCodec>>()
|
.remap_data_type::<LazyDecode<FacetGroupValueCodec>>()
|
||||||
{
|
.filter_map(|result| match result {
|
||||||
let (FacetGroupKey { left_bound, .. }, lazy_group_value) = result?;
|
Ok((FacetGroupKey { left_bound, .. }, lazy_group_value)) => {
|
||||||
if finder.find(left_bound.as_bytes()).is_some() {
|
match finder.find(left_bound.as_bytes()) {
|
||||||
let FacetGroupValue { bitmap, .. } = lazy_group_value.decode()?;
|
Some(_) => Some(lazy_group_value.decode().map(|gv| gv.bitmap)),
|
||||||
docids |= bitmap;
|
None => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(e) => Some(Err(e)),
|
||||||
|
})
|
||||||
|
.union()?;
|
||||||
|
|
||||||
return Ok(docids);
|
return Ok(docids);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user