mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 06:44:27 +01:00
Use word_prefix_docids, make get_word_prefix_docids private
This commit is contained in:
parent
c20c38a7fa
commit
7a01f20df7
@ -138,7 +138,7 @@ impl<'ctx> SearchContext<'ctx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieve or insert the given value in the `word_prefix_docids` database.
|
/// Retrieve or insert the given value in the `word_prefix_docids` database.
|
||||||
pub fn get_db_word_prefix_docids(
|
fn get_db_word_prefix_docids(
|
||||||
&mut self,
|
&mut self,
|
||||||
prefix: Interned<String>,
|
prefix: Interned<String>,
|
||||||
) -> Result<Option<RoaringBitmap>> {
|
) -> Result<Option<RoaringBitmap>> {
|
||||||
|
@ -434,7 +434,7 @@ fill: \"#B6E2D3\"
|
|||||||
writeln!(file, "{}: phrase", p.description(ctx))?;
|
writeln!(file, "{}: phrase", p.description(ctx))?;
|
||||||
}
|
}
|
||||||
if let Some(w) = term_subset.use_prefix_db(ctx) {
|
if let Some(w) = term_subset.use_prefix_db(ctx) {
|
||||||
let w = ctx.word_interner.get(w);
|
let w = ctx.word_interner.get(w.interned());
|
||||||
writeln!(file, "{w}: prefix db")?;
|
writeln!(file, "{w}: prefix db")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,12 +159,12 @@ impl QueryTermSubset {
|
|||||||
self.two_typo_subset.intersect(&other.two_typo_subset);
|
self.two_typo_subset.intersect(&other.two_typo_subset);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn use_prefix_db(&self, ctx: &SearchContext) -> Option<Interned<String>> {
|
pub fn use_prefix_db(&self, ctx: &SearchContext) -> Option<Word> {
|
||||||
let original = ctx.term_interner.get(self.original);
|
let original = ctx.term_interner.get(self.original);
|
||||||
let Some(use_prefix_db) = original.zero_typo.use_prefix_db else {
|
let Some(use_prefix_db) = original.zero_typo.use_prefix_db else {
|
||||||
return None
|
return None
|
||||||
};
|
};
|
||||||
match &self.zero_typo_subset {
|
let word = match &self.zero_typo_subset {
|
||||||
NTypoTermSubset::All => Some(use_prefix_db),
|
NTypoTermSubset::All => Some(use_prefix_db),
|
||||||
NTypoTermSubset::Subset { words, phrases: _ } => {
|
NTypoTermSubset::Subset { words, phrases: _ } => {
|
||||||
// TODO: use a subset of prefix words instead
|
// TODO: use a subset of prefix words instead
|
||||||
@ -175,7 +175,14 @@ impl QueryTermSubset {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NTypoTermSubset::Nothing => None,
|
NTypoTermSubset::Nothing => None,
|
||||||
}
|
};
|
||||||
|
word.map(|word| {
|
||||||
|
if original.ngram_words.is_some() {
|
||||||
|
Word::Derived(word)
|
||||||
|
} else {
|
||||||
|
Word::Original(word)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
pub fn all_single_words_except_prefix_db(
|
pub fn all_single_words_except_prefix_db(
|
||||||
&self,
|
&self,
|
||||||
|
@ -55,7 +55,7 @@ pub fn compute_docids(
|
|||||||
compute_prefix_edges(
|
compute_prefix_edges(
|
||||||
ctx,
|
ctx,
|
||||||
left_word.interned(),
|
left_word.interned(),
|
||||||
right_prefix,
|
right_prefix.interned(),
|
||||||
left_phrase,
|
left_phrase,
|
||||||
forward_proximity,
|
forward_proximity,
|
||||||
backward_proximity,
|
backward_proximity,
|
||||||
|
@ -44,7 +44,7 @@ pub fn compute_query_term_subset_docids(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(prefix) = term.use_prefix_db(ctx) {
|
if let Some(prefix) = term.use_prefix_db(ctx) {
|
||||||
if let Some(prefix_docids) = ctx.get_db_word_prefix_docids(prefix)? {
|
if let Some(prefix_docids) = ctx.word_prefix_docids(prefix)? {
|
||||||
docids |= prefix_docids;
|
docids |= prefix_docids;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user