Skip to content

Commit a151971

Browse files
committed
Improved grammar for the RERANK command.
1 parent 62e42a5 commit a151971

File tree

12 files changed

+1037
-1142
lines changed

12 files changed

+1037
-1142
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ required_capability: match_function
99

1010
FROM books METADATA _score
1111
| WHERE title:"war and peace" AND author:"Tolstoy"
12-
| RERANK "war and peace" ON title WITH "test_reranker"
12+
| RERANK "war and peace" ON title WITH test_reranker
1313
| KEEP book_no, title, author, _score
1414
;
1515

@@ -27,7 +27,7 @@ required_capability: match_function
2727

2828
FROM books METADATA _score
2929
| WHERE title:"war and peace" AND author:"Tolstoy"
30-
| RERANK "war and peace" ON title, author WITH "test_reranker"
30+
| RERANK "war and peace" ON title, author WITH test_reranker
3131
| KEEP book_no, title, author, _score
3232
;
3333

@@ -47,7 +47,7 @@ FROM books METADATA _score
4747
| WHERE title:"war and peace" AND author:"Tolstoy"
4848
| SORT _score DESC
4949
| LIMIT 3
50-
| RERANK "war and peace" ON title WITH "test_reranker"
50+
| RERANK "war and peace" ON title WITH test_reranker
5151
| KEEP book_no, title, author, _score
5252
;
5353

@@ -64,7 +64,7 @@ required_capability: match_function
6464

6565
FROM books METADATA _score
6666
| WHERE title:"war and peace" AND author:"Tolstoy"
67-
| RERANK "war and peace" ON title WITH "test_reranker"
67+
| RERANK "war and peace" ON title WITH test_reranker
6868
| KEEP book_no, title, author, _score
6969
| LIMIT 3
7070
;
@@ -82,7 +82,7 @@ required_capability: match_function
8282

8383
FROM books
8484
| WHERE title:"war and peace" AND author:"Tolstoy"
85-
| RERANK "war and peace" ON title WITH "test_reranker"
85+
| RERANK "war and peace" ON title WITH test_reranker
8686
| KEEP book_no, title, author, _score
8787
;
8888

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ identifierOrParameter
176176
| {this.isDevVersion()}? doubleParameter
177177
;
178178

179-
stringOrParameter
180-
: string
181-
| parameter
182-
;
183-
184179
limitCommand
185180
: LIMIT INTEGER_LITERAL
186181
;
@@ -296,5 +291,5 @@ rrfCommand
296291
;
297292

298293
rerankCommand
299-
: DEV_RERANK queryText=stringOrParameter ON fields WITH inferenceId=stringOrParameter
294+
: DEV_RERANK queryText=constant ON fields WITH inferenceId=identifierOrParameter
300295
;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)