diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 70227b8f9..43d903d16 100755 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -146,7 +146,12 @@ impl fmt::Debug for Query { trait Context { fn word_docids(&self, word: &str) -> heed::Result>; - fn word_pair_proximity_docids(&self, right_word: &str, left_word: &str, proximity: u8) -> heed::Result>; + fn word_pair_proximity_docids( + &self, + right_word: &str, + left_word: &str, + proximity: u8, + ) -> heed::Result>; fn synonyms>(&self, words: &[S]) -> heed::Result>>>; fn word_documents_count(&self, word: &str) -> heed::Result> { match self.word_docids(word)? { @@ -157,7 +162,12 @@ trait Context { /// Returns the minimum word len for 1 and 2 typos. fn min_word_len_for_typo(&self) -> heed::Result<(u8, u8)>; fn exact_words(&self) -> Option<&fst::Set>>; - fn word_pair_frequency(&self, left_word: &str, right_word: &str, proximity: u8) -> heed::Result> { + fn word_pair_frequency( + &self, + left_word: &str, + right_word: &str, + proximity: u8, + ) -> heed::Result> { match self.word_pair_proximity_docids(right_word, left_word, proximity)? { Some(rb) => Ok(Some(rb.len())), None => Ok(None), @@ -180,7 +190,12 @@ impl<'a> Context for QueryTreeBuilder<'a> { self.index.word_docids.get(self.rtxn, word) } - fn word_pair_proximity_docids(&self, right_word: &str, left_word: &str, proximity: u8) -> heed::Result> { + fn word_pair_proximity_docids( + &self, + right_word: &str, + left_word: &str, + proximity: u8, + ) -> heed::Result> { self.index.word_pair_proximity_docids.get(self.rtxn, &(left_word, right_word, proximity)) } @@ -202,9 +217,17 @@ impl<'a> Context for QueryTreeBuilder<'a> { self.exact_words.as_ref() } - fn word_pair_frequency(&self, left_word: &str, right_word: &str, proximity: u8) -> heed::Result> { + fn word_pair_frequency( + &self, + left_word: &str, + right_word: &str, + proximity: u8, + ) -> heed::Result> { let key = (left_word, right_word, proximity); - self.index.word_pair_proximity_docids.remap_data_type::().get(&self.rtxn, &key) + self.index + .word_pair_proximity_docids + .remap_data_type::() + .get(&self.rtxn, &key) } } @@ -838,7 +861,12 @@ mod test { Ok(self.postings.get(word).cloned()) } - fn word_pair_proximity_docids(&self, right_word: &str, left_word: &str, _: u8) -> heed::Result> { + fn word_pair_proximity_docids( + &self, + right_word: &str, + left_word: &str, + _: u8, + ) -> heed::Result> { let bitmap = self.postings.get(&format!("{} {}", left_word, right_word)); Ok(bitmap.cloned()) }