File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
core/src/test/java/org/opensearch/sql/analysis Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,33 @@ public void analyze_filter_visit_score_function() {
7272 assertEquals (true , relevanceQuery .isScoreTracked ());
7373 }
7474
75+ @ Test
76+ public void analyze_filter_visit_score_function_without_boost () {
77+
78+ // setup
79+ OpenSearchFunction scoreFunction = new OpenSearchFunction (
80+ new FunctionName ("match_phrase_prefix" ), List .of ());
81+ when (builtinFunctionRepository .compile (any (), any (), any ())).thenReturn (scoreFunction );
82+
83+ UnresolvedPlan unresolvedPlan =
84+ AstDSL .filter (
85+ AstDSL .relation ("schema" ),
86+ new ScoreFunction (
87+ AstDSL .function (
88+ "match_phrase_prefix" ,
89+ AstDSL .unresolvedArg ("field" , stringLiteral ("field_value1" )),
90+ AstDSL .unresolvedArg ("query" , stringLiteral ("search query" ))),
91+ AstDSL .doubleLiteral (1.0 )));
92+
93+ // test
94+ LogicalPlan logicalPlan = analyze (unresolvedPlan );
95+ OpenSearchFunction relevanceQuery =
96+ (OpenSearchFunction ) ((LogicalFilter ) logicalPlan ).getCondition ();
97+
98+ // verify
99+ assertEquals (true , relevanceQuery .isScoreTracked ());
100+ }
101+
75102 @ Test
76103 public void analyze_filter_visit_score_function_with_unsupported_boost_SemanticCheckException () {
77104
You can’t perform that action at this time.
0 commit comments