Remove self.iterating from words

This commit is contained in:
Louis Dureuil 2023-05-02 18:54:23 +02:00
parent fdc1763838
commit b60840ebff
No known key found for this signature in database

View File

@ -1,15 +1,15 @@
use roaring::RoaringBitmap;
use super::logger::SearchLogger; use super::logger::SearchLogger;
use super::query_graph::QueryNode; use super::query_graph::QueryNode;
use super::resolve_query_graph::compute_query_graph_docids; use super::resolve_query_graph::compute_query_graph_docids;
use super::small_bitmap::SmallBitmap; use super::small_bitmap::SmallBitmap;
use super::{QueryGraph, RankingRule, RankingRuleOutput, SearchContext}; use super::{QueryGraph, RankingRule, RankingRuleOutput, SearchContext};
use crate::{Result, TermsMatchingStrategy}; use crate::{Result, TermsMatchingStrategy};
use roaring::RoaringBitmap;
pub struct Words { pub struct Words {
exhausted: bool, // TODO: remove exhausted: bool, // TODO: remove
query_graph: Option<QueryGraph>, query_graph: Option<QueryGraph>,
iterating: bool, // TODO: remove
nodes_to_remove: Vec<SmallBitmap<QueryNode>>, nodes_to_remove: Vec<SmallBitmap<QueryNode>>,
terms_matching_strategy: TermsMatchingStrategy, terms_matching_strategy: TermsMatchingStrategy,
} }
@ -18,7 +18,6 @@ impl Words {
Self { Self {
exhausted: true, exhausted: true,
query_graph: None, query_graph: None,
iterating: false,
nodes_to_remove: vec![], nodes_to_remove: vec![],
terms_matching_strategy, terms_matching_strategy,
} }
@ -48,7 +47,6 @@ impl<'ctx> RankingRule<'ctx, QueryGraph> for Words {
vec![] vec![]
} }
}; };
self.iterating = true;
Ok(()) Ok(())
} }
@ -58,9 +56,6 @@ impl<'ctx> RankingRule<'ctx, QueryGraph> for Words {
logger: &mut dyn SearchLogger<QueryGraph>, logger: &mut dyn SearchLogger<QueryGraph>,
universe: &RoaringBitmap, universe: &RoaringBitmap,
) -> Result<Option<RankingRuleOutput<QueryGraph>>> { ) -> Result<Option<RankingRuleOutput<QueryGraph>>> {
assert!(self.iterating);
assert!(universe.len() > 1);
if self.exhausted { if self.exhausted {
return Ok(None); return Ok(None);
} }
@ -85,7 +80,6 @@ impl<'ctx> RankingRule<'ctx, QueryGraph> for Words {
_ctx: &mut SearchContext<'ctx>, _ctx: &mut SearchContext<'ctx>,
_logger: &mut dyn SearchLogger<QueryGraph>, _logger: &mut dyn SearchLogger<QueryGraph>,
) { ) {
self.iterating = false;
self.exhausted = true; self.exhausted = true;
self.nodes_to_remove = vec![]; self.nodes_to_remove = vec![];
self.query_graph = None; self.query_graph = None;