remove underscore and introduce back word_documents_count

This commit is contained in:
Akshay Kulkarni 2022-10-13 13:21:59 +05:30
parent 8195fc6141
commit 85f3028317
No known key found for this signature in database
GPG Key ID: CAB2F21265743909

View File

@ -160,7 +160,7 @@ trait Context {
&self,
left_word: &str,
right_word: &str,
_proximity: u8,
proximity: u8,
) -> heed::Result<Option<u64>>;
}
@ -183,6 +183,10 @@ impl<'a> Context for QueryTreeBuilder<'a> {
self.index.words_synonyms(self.rtxn, words)
}
fn word_documents_count(&self, word: &str) -> heed::Result<Option<u64>> {
self.index.word_documents_count(self.rtxn, word)
}
fn min_word_len_for_typo(&self) -> heed::Result<(u8, u8)> {
let one = self.index.min_word_len_one_typo(&self.rtxn)?;
let two = self.index.min_word_len_two_typos(&self.rtxn)?;
@ -511,7 +515,7 @@ fn create_query_tree(
.filter(|(_, part)| !part.is_phrase())
.max_by_key(|(_, part)| match part {
PrimitiveQueryPart::Word(s, _) => {
ctx.word_documents_count(s).unwrap_or_default().unwrap_or(u64::max_value());
ctx.word_documents_count(s).unwrap_or_default().unwrap_or(u64::max_value())
}
_ => unreachable!(),
})