Update query term structure to allow for laziness

This commit is contained in:
Loïc Lecrenier 2023-03-30 09:52:47 +02:00
parent 3a818c5e87
commit 9507ff5e31
4 changed files with 625 additions and 306 deletions

View File

@ -373,7 +373,7 @@ impl<'ctx, G: RankingRuleGraphTrait> RankingRule<'ctx, QueryGraph> for GraphBase
if new_term.is_empty() {
nodes_to_remove.push(node_id);
} else {
term.value = ctx.term_interner.insert(new_term);
term.value = ctx.term_interner.push(new_term);
}
}
}

View File

@ -32,6 +32,7 @@ use resolve_query_graph::{resolve_query_graph, QueryTermDocIdsCache};
use roaring::RoaringBitmap;
use words::Words;
use self::interner::Interner;
use self::ranking_rules::{BoxRankingRule, RankingRule};
use self::sort::Sort;
use crate::{
@ -46,7 +47,7 @@ pub struct SearchContext<'ctx> {
pub db_cache: DatabaseCache<'ctx>,
pub word_interner: DedupInterner<String>,
pub phrase_interner: DedupInterner<Phrase>,
pub term_interner: DedupInterner<QueryTerm>,
pub term_interner: Interner<QueryTerm>,
// think about memory usage of that field (roaring bitmaps in a hashmap)
pub term_docids: QueryTermDocIdsCache,
}

File diff suppressed because it is too large Load Diff

View File

@ -128,7 +128,7 @@ impl RankingRuleGraphTrait for TypoGraph {
nbr_typos as u8 + base_cost,
Some(
conditions_interner
.insert(TypoCondition { term: term_interner.insert(new_term) }),
.insert(TypoCondition { term: term_interner.push(new_term) }),
),
))
}