@@ -48,7 +48,7 @@ public void testScoreDifferentWhereMatch() {
4848 }
4949 }
5050
51- public void testScoreMultipleWhereMatchMatch () {
51+ public void testScoreMultipleWhereMatch () {
5252 var query = """
5353 FROM test METADATA _score
5454 | WHERE match(content, "brown")
@@ -146,6 +146,29 @@ public void testScoreSingleWhereQstrAndMatch() {
146146 }
147147 }
148148
149+ public void testScoreBothWhereQstrAndMatch () {
150+ var query = """
151+ FROM test METADATA _score
152+ | WHERE qstr("brown") AND match(content, "fox")
153+ | EVAL first_score = score(qstr("brown"))
154+ | EVAL second_score = score(match(content, "fox"))
155+ | KEEP id, _score, first_score, second_score
156+ | SORT id
157+ """ ;
158+
159+ try (var resp = run (query )) {
160+ assertColumnNames (resp .columns (), List .of ("id" , "_score" , "first_score" , "second_score" ));
161+ assertColumnTypes (resp .columns (), List .of ("integer" , "double" , "double" , "double" ));
162+ assertValues (
163+ resp .values (),
164+ List .of (
165+ List .of (1 , 1.4274532794952393 , 0.2708943784236908 , 1.156558871269226 ),
166+ List .of (6 , 1.1248724460601807 , 0.21347221732139587 , 0.9114001989364624 )
167+ )
168+ );
169+ }
170+ }
171+
149172 public void testScoreSameWhereKqlAndMatch () {
150173 var query = """
151174 FROM test METADATA _score
@@ -184,6 +207,29 @@ public void testScoreSingleWhereKqlAndMatch() {
184207 }
185208 }
186209
210+ public void testScoreBothWhereKqlAndMatch () {
211+ var query = """
212+ FROM test METADATA _score
213+ | WHERE kql("brown") AND match(content, "fox")
214+ | EVAL first_score = score(kql("brown"))
215+ | EVAL second_score = score(match(content, "fox"))
216+ | KEEP id, _score, first_score, second_score
217+ | SORT id
218+ """ ;
219+
220+ try (var resp = run (query )) {
221+ assertColumnNames (resp .columns (), List .of ("id" , "_score" , "first_score" , "second_score" ));
222+ assertColumnTypes (resp .columns (), List .of ("integer" , "double" , "double" , "double" ));
223+ assertValues (
224+ resp .values (),
225+ List .of (
226+ List .of (1 , 1.4274532794952393 , 0.2708943784236908 , 1.156558871269226 ),
227+ List .of (6 , 1.1248724460601807 , 0.21347221732139587 , 0.9114001989364624 )
228+ )
229+ );
230+ }
231+ }
232+
187233 public void testScoreSameWhereQstrORMatch () {
188234 var query = """
189235 FROM test METADATA _score
@@ -234,6 +280,32 @@ public void testScoreSingleWhereQstrORMatch() {
234280 }
235281 }
236282
283+ public void testScoreBothWhereQstrORMatch () {
284+ var query = """
285+ FROM test METADATA _score
286+ | WHERE qstr("brown") OR match(content, "fox")
287+ | EVAL first_score = score(qstr("brown"))
288+ | EVAL second_score = score(match(content, "fox"))
289+ | KEEP id, _score, first_score, second_score
290+ | SORT id
291+ """ ;
292+
293+ try (var resp = run (query )) {
294+ assertColumnNames (resp .columns (), List .of ("id" , "_score" , "first_score" , "second_score" ));
295+ assertColumnTypes (resp .columns (), List .of ("integer" , "double" , "double" , "double" ));
296+ assertValues (
297+ resp .values (),
298+ List .of (
299+ List .of (1 , 1.4274532794952393 , 0.2708943784236908 , 1.156558871269226 ),
300+ List .of (2 , 0.2708943784236908 , 0.2708943784236908 , 0.0 ),
301+ List .of (3 , 0.2708943784236908 , 0.2708943784236908 , 0.0 ),
302+ List .of (4 , 0.19301524758338928 , 0.19301524758338928 , 0.0 ),
303+ List .of (6 , 1.1248724460601807 , 0.21347221732139587 , 0.9114001989364624 )
304+ )
305+ );
306+ }
307+ }
308+
237309 public void testSimpleScoreAlone () {
238310 var query = """
239311 FROM test METADATA _score
0 commit comments