mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-23 02:29:57 +00:00
perf: deduplicate queries (#2698)
* deduplicate queries Deduplicate queries in the UserInputAst after parsing queries * add return type
This commit is contained in:
@@ -672,7 +672,7 @@ impl QueryParser {
|
||||
}
|
||||
UserInputAst::Boost(ast, boost) => {
|
||||
let (ast, errors) = self.compute_logical_ast_with_occur_lenient(*ast);
|
||||
(ast.boost(boost as Score), errors)
|
||||
(ast.boost(boost.into_inner() as Score), errors)
|
||||
}
|
||||
UserInputAst::Leaf(leaf) => {
|
||||
let (ast, errors) = self.compute_logical_ast_from_leaf_lenient(*leaf);
|
||||
@@ -2050,6 +2050,16 @@ mod test {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_deduplication() {
|
||||
let query = "be be";
|
||||
test_parse_query_to_logical_ast_helper(
|
||||
query,
|
||||
"(Term(field=0, type=Str, \"be\") Term(field=1, type=Str, \"be\"))",
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_regex() {
|
||||
let expected_regex = tantivy_fst::Regex::new(r".*b").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user