From fdc17638381099b8c052652054d0307165fd78c6 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 2 May 2023 18:54:09 +0200 Subject: [PATCH] Use MultiOps for resolve_query_graph --- milli/src/search/new/resolve_query_graph.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/milli/src/search/new/resolve_query_graph.rs b/milli/src/search/new/resolve_query_graph.rs index 2bcb4d3ac..797db5875 100644 --- a/milli/src/search/new/resolve_query_graph.rs +++ b/milli/src/search/new/resolve_query_graph.rs @@ -3,7 +3,7 @@ use std::collections::VecDeque; use fxhash::FxHashMap; -use roaring::RoaringBitmap; +use roaring::{MultiOps, RoaringBitmap}; use super::interner::Interned; use super::query_graph::QueryNodeData; @@ -126,6 +126,7 @@ pub fn compute_query_term_subset_docids_within_position( Ok(docids) } +/// Returns the subset of the input universe that satisfies the contraints of the input query graph. pub fn compute_query_graph_docids( ctx: &mut SearchContext, q: &QueryGraph, @@ -148,10 +149,8 @@ pub fn compute_query_graph_docids( continue; } // Take union of all predecessors - let mut predecessors_docids = RoaringBitmap::new(); - for p in predecessors.iter() { - predecessors_docids |= path_nodes_docids.get(p); - } + let predecessors_docids = + MultiOps::union(predecessors.iter().map(|p| path_nodes_docids.get(p))); let node_docids = match &node.data { QueryNodeData::Term(LocatedQueryTermSubset {