From 32f825d442f3b1ade6c6fe70c1f161db267f3abb Mon Sep 17 00:00:00 2001 From: Akshay Kulkarni Date: Thu, 13 Oct 2022 12:57:50 +0530 Subject: [PATCH] move default implementation of word_pair_frequency to TestContext --- milli/src/search/query_tree.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 723192d20..8ab5f81a4 100755 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -155,12 +155,7 @@ trait Context { left_word: &str, right_word: &str, _proximity: u8, - ) -> heed::Result> { - match self.word_docids(&format!("{} {}", left_word, right_word))? { - Some(rb) => Ok(Some(rb.len())), - None => Ok(None), - } - } + ) -> heed::Result>; } /// The query tree builder is the interface to build a query tree. @@ -850,6 +845,18 @@ mod test { fn exact_words(&self) -> Option<&fst::Set>> { self.exact_words.as_ref() } + + fn word_pair_frequency( + &self, + left_word: &str, + right_word: &str, + _proximity: u8, + ) -> heed::Result> { + match self.word_docids(&format!("{} {}", left_word, right_word))? { + Some(rb) => Ok(Some(rb.len())), + None => Ok(None), + } + } } impl Default for TestContext {