diff --git a/query-grammar/src/lib.rs b/query-grammar/src/lib.rs index 2ba7c589e..c7c41df14 100644 --- a/query-grammar/src/lib.rs +++ b/query-grammar/src/lib.rs @@ -39,7 +39,7 @@ mod tests { let json = serde_json::to_string(&ast).unwrap(); assert_eq!( json, - r#"{"clause":[["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}],["should",{"type":"literal","field_name":"title","phrase":"x","delimiter":"none","slop":0,"prefix":false}]]}"# + r#"{"type":"bool","clauses":[["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}],["should",{"type":"literal","field_name":"title","phrase":"x","delimiter":"none","slop":0,"prefix":false}]]}"# ); } diff --git a/query-grammar/src/user_input_ast.rs b/query-grammar/src/user_input_ast.rs index bd079175f..dff85b4b3 100644 --- a/query-grammar/src/user_input_ast.rs +++ b/query-grammar/src/user_input_ast.rs @@ -206,8 +206,8 @@ pub enum UserInputAst { #[derive(Serialize)] #[serde(tag = "type", rename_all = "snake_case")] enum UserInputAstSerde { - Clause { - clause: Vec<(Option, UserInputAst)>, + Bool { + clauses: Vec<(Option, UserInputAst)>, }, Boost { underlying: Box, @@ -220,7 +220,7 @@ enum UserInputAstSerde { impl From for UserInputAstSerde { fn from(ast: UserInputAst) -> Self { match ast { - UserInputAst::Clause(clause) => UserInputAstSerde::Clause { clause }, + UserInputAst::Clause(clause) => UserInputAstSerde::Bool { clauses: clause }, UserInputAst::Boost(underlying, boost) => { UserInputAstSerde::Boost { underlying, boost } } @@ -414,7 +414,7 @@ mod tests { let json = serde_json::to_string(&boost_ast).unwrap(); assert_eq!( json, - r#"{"type":"boost","underlying":{"type":"clause","clause":[["must",{"type":"all"}],["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}]]},"boost":2.5}"# + r#"{"type":"boost","underlying":{"type":"bool","clauses":[["must",{"type":"all"}],["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}]]},"boost":2.5}"# ); } @@ -439,7 +439,7 @@ mod tests { let json = serde_json::to_string(&clause).unwrap(); assert_eq!( json, - r#"{"type":"clause","clause":[["must",{"type":"all"}],["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}]]}"# + r#"{"type":"bool","clauses":[["must",{"type":"all"}],["should",{"type":"literal","field_name":"title","phrase":"hello","delimiter":"none","slop":0,"prefix":false}]]}"# ); } }