Skip to content

Commit ae8c7cd

Browse files
Add initial version of scoring test
1 parent 3884437 commit ae8c7cd

File tree

3 files changed

+16
-1
lines changed
  • x-pack/plugin/esql

3 files changed

+16
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/scoring.csv-spec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ book_no:keyword | title:text
114114
6151 | Pop! Went Another Balloon: A Magical Counting Storybook (Magical Counting Storybooks) | [Keith Faulkner, Rory Tyger] | 5.975414276123047
115115
;
116116

117+
testMultiMatchWithScore
118+
required_capability: multi_match_function
119+
required_capability: metadata_score
120+
121+
from books metadata _score
122+
| where multi_match("Mark", "author", "title", {"fuzziness": 1})
123+
| keep book_no, title, author, _score;
124+
ignoreOrder:true
125+
126+
book_no:keyword | title:text | author:text | _score:double
127+
3535 | Rainbow's End: A Magical Story and Moneybox | [Beverlie Manson, Keith Faulkner] | 6.5579609870910645
128+
6151 | Pop! Went Another Balloon: A Magical Counting Storybook (Magical Counting Storybooks) | [Keith Faulkner, Rory Tyger] | 5.975414276123047
129+
;
130+
117131
multipleWhereWithMatchScoringNoSort
118132
required_capability: metadata_score
119133
required_capability: match_operator_colon

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/ScoringIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
4646
public static List<Object[]> params() {
4747
List<Object[]> params = new ArrayList<>();
4848
params.add(new Object[] { "match(content, \"fox\")" });
49+
params.add(new Object[] { "multi_match(\"fox\", \"content\", {\"operator\": \"AND\"})" });
4950
params.add(new Object[] { "content:\"fox\"" });
5051
params.add(new Object[] { "qstr(\"content: fox\")" });
5152
params.add(new Object[] { "kql(\"content*: fox\")" });

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MultiMatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private TypeResolution resolveFields() {
311311
)
312312
)
313313
.reduce(TypeResolution::and)
314-
.get();
314+
.orElse(null);
315315
}
316316

317317
private TypeResolution resolveOptions() {

0 commit comments

Comments
 (0)