Everyone uses the SearchContext::word_docids instead of get_db_word_docids

make get_db_word_docids private
This commit is contained in:
Louis Dureuil
2023-04-11 18:27:41 +02:00
committed by Loïc Lecrenier
parent 325f17488a
commit 5ab46324c4
7 changed files with 46 additions and 27 deletions

View File

@ -3,7 +3,8 @@ use roaring::RoaringBitmap;
use super::{ComputedCondition, RankingRuleGraphTrait};
use crate::search::new::interner::{DedupInterner, Interned};
use crate::search::new::query_term::{ExactTerm, LocatedQueryTermSubset};
use crate::{Result, RoaringBitmapCodec, SearchContext};
use crate::search::new::Word;
use crate::{Result, SearchContext};
#[derive(Clone, PartialEq, Eq, Hash)]
pub enum ExactnessCondition {
@ -26,7 +27,7 @@ fn compute_docids(
let mut candidates = match exact_term {
ExactTerm::Phrase(phrase) => ctx.get_phrase_docids(phrase)?.clone(),
ExactTerm::Word(word) => {
if let Some(word_candidates) = ctx.get_db_word_docids(word)? {
if let Some(word_candidates) = ctx.word_docids(Word::Original(word))? {
word_candidates
} else {
return Ok(Default::default());

View File

@ -9,7 +9,7 @@ use crate::search::new::interner::Interned;
use crate::search::new::query_term::{Phrase, QueryTermSubset};
use crate::search::new::ranking_rule_graph::ComputedCondition;
use crate::search::new::resolve_query_graph::compute_query_term_subset_docids;
use crate::search::new::SearchContext;
use crate::search::new::{SearchContext, Word};
use crate::Result;
pub fn compute_docids(
@ -54,7 +54,7 @@ pub fn compute_docids(
{
compute_prefix_edges(
ctx,
left_word,
left_word.interned(),
right_prefix,
left_phrase,
forward_proximity,
@ -91,7 +91,7 @@ pub fn compute_docids(
if universe.is_disjoint(ctx.get_phrase_docids(left_phrase)?) {
continue;
}
} else if let Some(left_word_docids) = ctx.get_db_word_docids(left_word)? {
} else if let Some(left_word_docids) = ctx.word_docids(left_word)? {
if universe.is_disjoint(&left_word_docids) {
continue;
}
@ -101,7 +101,7 @@ pub fn compute_docids(
for (right_word, right_phrase) in right_derivs {
compute_non_prefix_edges(
ctx,
left_word,
left_word.interned(),
right_word,
left_phrase,
right_phrase,
@ -243,7 +243,7 @@ fn compute_non_prefix_edges(
fn last_words_of_term_derivations(
ctx: &mut SearchContext,
t: &QueryTermSubset,
) -> Result<BTreeSet<(Option<Interned<Phrase>>, Interned<String>)>> {
) -> Result<BTreeSet<(Option<Interned<Phrase>>, Word)>> {
let mut result = BTreeSet::new();
for w in t.all_single_words_except_prefix_db(ctx)? {
@ -253,7 +253,7 @@ fn last_words_of_term_derivations(
let phrase = ctx.phrase_interner.get(p);
let last_term_of_phrase = phrase.words.last().unwrap();
if let Some(last_word) = last_term_of_phrase {
result.insert((Some(p), *last_word));
result.insert((Some(p), Word::Original(*last_word)));
}
}
@ -266,7 +266,7 @@ fn first_word_of_term_iter(
let mut result = BTreeSet::new();
let all_words = t.all_single_words_except_prefix_db(ctx)?;
for w in all_words {
result.insert((w, None));
result.insert((w.interned(), None));
}
for p in t.all_phrases(ctx)? {
let phrase = ctx.phrase_interner.get(p);