Remove the roaring operation functions warnings

This commit is contained in:
Kerollmops
2021-06-30 14:12:56 +02:00
parent 66e6ea56b8
commit 32b7bd366f
14 changed files with 43 additions and 45 deletions

View File

@ -328,7 +328,7 @@ pub fn resolve_query_tree<'t>(
candidates = docids;
first_loop = false;
} else {
candidates.intersect_with(&docids);
candidates &= &docids;
}
}
Ok(candidates)
@ -358,7 +358,7 @@ pub fn resolve_query_tree<'t>(
let mut candidates = RoaringBitmap::new();
for op in ops {
let docids = resolve_operation(ctx, op, wdcache)?;
candidates.union_with(&docids);
candidates |= docids;
}
Ok(candidates)
}
@ -381,7 +381,7 @@ fn all_word_pair_proximity_docids<T: AsRef<str>, U: AsRef<str>>(
let current_docids = ctx
.word_pair_proximity_docids(left.as_ref(), right.as_ref(), proximity)?
.unwrap_or_default();
docids.union_with(&current_docids);
docids |= current_docids;
}
}
Ok(docids)
@ -401,7 +401,7 @@ fn query_docids(
let mut docids = RoaringBitmap::new();
for (word, _typo) in words {
let current_docids = ctx.word_docids(&word)?.unwrap_or_default();
docids.union_with(&current_docids);
docids |= current_docids;
}
Ok(docids)
} else {
@ -413,7 +413,7 @@ fn query_docids(
let mut docids = RoaringBitmap::new();
for (word, _typo) in words {
let current_docids = ctx.word_docids(&word)?.unwrap_or_default();
docids.union_with(&current_docids);
docids |= current_docids;
}
Ok(docids)
}
@ -430,7 +430,7 @@ fn query_pair_proximity_docids(
if proximity >= 8 {
let mut candidates = query_docids(ctx, left, wdcache)?;
let right_candidates = query_docids(ctx, right, wdcache)?;
candidates.intersect_with(&right_candidates);
candidates &= right_candidates;
return Ok(candidates);
}
@ -463,7 +463,7 @@ fn query_pair_proximity_docids(
proximity,
)?
.unwrap_or_default();
docids.union_with(&current_docids);
docids |= current_docids;
}
Ok(docids)
} else if prefix {

View File

@ -274,11 +274,11 @@ fn resolve_candidates<'t>(
let mut candidates =
query_pair_proximity_docids(ctx, lr, rl, pair_p + 1, wdcache)?;
if lcandidates.len() < rcandidates.len() {
candidates.intersect_with(lcandidates);
candidates.intersect_with(rcandidates);
candidates &= lcandidates;
candidates &= rcandidates;
} else {
candidates.intersect_with(rcandidates);
candidates.intersect_with(lcandidates);
candidates &= rcandidates;
candidates &= lcandidates;
}
if !candidates.is_empty() {
output.push((ll.clone(), rr.clone(), candidates));
@ -317,7 +317,7 @@ fn resolve_candidates<'t>(
for (_, rtail, mut candidates) in
mdfs(ctx, tail, proximity - p, cache, wdcache)?
{
candidates.intersect_with(&head_candidates);
candidates &= &head_candidates;
if !candidates.is_empty() {
output.push((lhead.clone(), rtail, candidates));
}
@ -334,7 +334,7 @@ fn resolve_candidates<'t>(
let mut candidates = RoaringBitmap::new();
for (_, _, cds) in resolve_operation(ctx, query_tree, proximity, cache, wdcache)? {
candidates.union_with(&cds);
candidates |= cds;
}
Ok(candidates)
}

View File

@ -281,7 +281,7 @@ fn resolve_candidates<'t>(
let mut candidates = RoaringBitmap::new();
for op in ops {
let docids = resolve_operation(ctx, op, number_typos, cache, wdcache)?;
candidates.union_with(&docids);
candidates |= docids;
}
Ok(candidates)
}
@ -329,8 +329,8 @@ fn resolve_candidates<'t>(
};
if !head_candidates.is_empty() {
let tail_candidates = mdfs(ctx, tail, mana - m, cache, wdcache)?;
head_candidates.intersect_with(&tail_candidates);
candidates.union_with(&head_candidates);
head_candidates &= tail_candidates;
candidates |= head_candidates;
}
}

View File

@ -61,7 +61,7 @@ impl<'a> FacetDistinctIter<'a> {
db_name: db_name::FACET_ID_STRING_DOCIDS,
key: None,
})?;
self.excluded.union_with(&facet_docids);
self.excluded |= facet_docids;
}
self.excluded.remove(id);
@ -79,7 +79,7 @@ impl<'a> FacetDistinctIter<'a> {
db_name: db_name::FACET_ID_F64_DOCIDS,
key: None,
})?;
self.excluded.union_with(&facet_docids);
self.excluded |= facet_docids;
}
self.excluded.remove(id);
@ -92,7 +92,7 @@ impl<'a> FacetDistinctIter<'a> {
/// handling easier.
fn next_inner(&mut self) -> Result<Option<DocumentId>> {
// The first step is to remove all the excluded documents from our candidates
self.candidates.difference_with(&self.excluded);
self.candidates -= &self.excluded;
let mut candidates_iter = self.candidates.iter().skip(self.iter_offset);
match candidates_iter.next() {

View File

@ -122,7 +122,7 @@ impl<'a> FacetDistribution<'a> {
for result in iter {
let (value, mut docids) = result?;
docids.intersect_with(candidates);
docids &= candidates;
if !docids.is_empty() {
distribution.insert(value.to_string(), docids.len());
}

View File

@ -289,7 +289,7 @@ impl FilterCondition {
for (i, result) in iter.enumerate() {
let ((_fid, level, l, r), docids) = result?;
debug!("{:?} to {:?} (level {}) found {} documents", l, r, level, docids.len());
output.union_with(&docids);
*output |= docids;
// We save the leftest and rightest bounds we actually found at this level.
if i == 0 {
left_found = Some(l);

View File

@ -213,10 +213,10 @@ impl<'t> Iterator for FacetIter<'t> {
match result {
Ok(((_fid, level, left, right), mut docids)) => {
docids.intersect_with(&documents_ids);
docids &= &*documents_ids;
if !docids.is_empty() {
if self.must_reduce {
documents_ids.difference_with(&docids);
*documents_ids -= &docids;
}
if level == 0 {

View File

@ -173,7 +173,7 @@ impl<'a> Search<'a> {
let mut candidates = distinct.distinct(candidates, excluded);
initial_candidates.union_with(&bucket_candidates);
initial_candidates |= bucket_candidates;
if offset != 0 {
let discarded = candidates.by_ref().take(offset).count();