Imrpove the intersection speed in the words criterion

This commit is contained in:
Kerollmops 2021-02-24 14:48:12 +01:00
parent ef381e17bb
commit 3415812b06
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -129,10 +129,15 @@ fn resolve_candidates<'t>(
match query_tree {
And(ops) => {
let mut ops = ops.iter().map(|op| {
resolve_operation(ctx, op, cache)
}).collect::<anyhow::Result<Vec<_>>>()?;
ops.sort_unstable_by_key(|cds| cds.len());
let mut candidates = RoaringBitmap::new();
let mut first_loop = true;
for op in ops {
let docids = resolve_operation(ctx, op, cache)?;
for docids in ops {
if first_loop {
candidates = docids;
first_loop = false;