33// This makes the output more predictable which is helpful here.
44
55
6- reranker using a single field
6+ reranker using a single field, overwrite existing _score column
77required_capability: rerank
88required_capability: match_operator_colon
99
1010FROM books METADATA _score
1111| WHERE title:"war and peace" AND author:"Tolstoy"
12+ | SORT _score DESC, book_no ASC
1213| RERANK "war and peace" ON title WITH inferenceId=test_reranker
13- | KEEP book_no, title, author
14+ | EVAL _score=ROUND(_score, 2)
15+ | KEEP book_no, title, author, _score
1416;
1517
16- book_no:keyword | title:text | author:text
17- 5327 | War and Peace | Leo Tolstoy
18- 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy]
19- 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo
20- 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy
18+ book_no:keyword | title:text | author:text | _score:double
19+ 5327 | War and Peace | Leo Tolstoy | 0.08
20+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
21+ 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo | 0.03
22+ 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy | 0.02
23+ ;
24+
25+ reranker using a single field, create a mew column
26+ required_capability: rerank
27+ required_capability: match_operator_colon
28+
29+ FROM books METADATA _score
30+ | WHERE title:"war and peace" AND author:"Tolstoy"
31+ | SORT _score DESC, book_no ASC
32+ | RERANK "war and peace" ON title WITH inferenceId=test_reranker, scoreColumn=rerank_score
33+ | EVAL _score=ROUND(_score, 2), rerank_score=ROUND(rerank_score, 2)
34+ | KEEP book_no, title, author, rerank_score
35+ ;
36+
37+ book_no:keyword | title:text | author:text | rerank_score:double
38+ 5327 | War and Peace | Leo Tolstoy | 0.08
39+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
40+ 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo | 0.03
41+ 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy | 0.02
42+ ;
43+
44+ reranker using a single field, create a mew column, sort by rerank_score
45+ required_capability: rerank
46+ required_capability: match_operator_colon
47+
48+ FROM books METADATA _score
49+ | WHERE title:"war and peace" AND author:"Tolstoy"
50+ | SORT _score DESC
51+ | RERANK "war and peace" ON title WITH inferenceId=test_reranker, scoreColumn=rerank_score
52+ | EVAL _score=ROUND(_score, 2), rerank_score=ROUND(rerank_score, 2)
53+ | SORT rerank_score, _score ASC, book_no ASC
54+ | KEEP book_no, title, author, rerank_score
55+ ;
56+
57+ book_no:keyword | title:text | author:text | rerank_score:double
58+ 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy | 0.02
59+ 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo | 0.03
60+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
61+ 5327 | War and Peace | Leo Tolstoy | 0.08
2162;
2263
2364
@@ -27,15 +68,17 @@ required_capability: match_operator_colon
2768
2869FROM books METADATA _score
2970| WHERE title:"war and peace" AND author:"Tolstoy"
30- | RERANK "war and peace" ON title, author inferenceId=test_reranker
31- | KEEP book_no, title, author
71+ | RERANK "war and peace" ON title, author WITH inferenceId=test_reranker
72+ | EVAL _score=ROUND(_score, 2)
73+ | SORT _score DESC, book_no ASC
74+ | KEEP book_no, title, author, _score
3275;
3376
34- book_no:keyword | title:text | author:text
35- 5327 | War and Peace | Leo Tolstoy
36- 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo
37- 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy
38- 4536 | War and Peace (Signet Classics ) | [John Hockenberry, Leo Tolstoy, Pat Conroy]
77+ book_no:keyword | title:text | author:text | _score:double
78+ 5327 | War and Peace | Leo Tolstoy | 0.02
79+ 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy | 0.01
80+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.01
81+ 9032 | War and Peace: A Novel (6 Volumes ) | Tolstoy Leo | 0.01
3982;
4083
4184
@@ -45,16 +88,18 @@ required_capability: match_operator_colon
4588
4689FROM books METADATA _score
4790| WHERE title:"war and peace" AND author:"Tolstoy"
48- | SORT _score DESC
91+ | SORT _score DESC, book_no ASC
4992| LIMIT 3
50- | RERANK "war and peace" ON title inferenceId=test_reranker
51- | KEEP book_no, title, author
93+ | RERANK "war and peace" ON title WITH inferenceId=test_reranker
94+ | EVAL _score=ROUND(_score, 2)
95+ | SORT _score DESC, book_no ASC
96+ | KEEP book_no, title, author, _score
5297;
5398
54- book_no:keyword | title:text | author:text
55- 5327 | War and Peace | Leo Tolstoy
56- 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy]
57- 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo
99+ book_no:keyword | title:text | author:text | _score:double
100+ 5327 | War and Peace | Leo Tolstoy | 0.08
101+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
102+ 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo | 0.03
58103;
59104
60105
@@ -64,15 +109,17 @@ required_capability: match_operator_colon
64109
65110FROM books METADATA _score
66111| WHERE title:"war and peace" AND author:"Tolstoy"
67- | RERANK "war and peace" ON title inferenceId=test_reranker
68- | KEEP book_no, title, author
112+ | RERANK "war and peace" ON title WITH inferenceId=test_reranker
113+ | EVAL _score=ROUND(_score, 2)
114+ | SORT _score DESC, book_no ASC
115+ | KEEP book_no, title, author, _score
69116| LIMIT 3
70117;
71118
72- book_no:keyword | title:text | author:text
73- 5327 | War and Peace | Leo Tolstoy
74- 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy]
75- 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo
119+ book_no:keyword | title:text | author:text | _score:double
120+ 5327 | War and Peace | Leo Tolstoy | 0.08
121+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
122+ 9032 | War and Peace: A Novel (6 Volumes) | Tolstoy Leo | 0.03
76123;
77124
78125
@@ -82,16 +129,17 @@ required_capability: match_operator_colon
82129
83130FROM books
84131| WHERE title:"war and peace" AND author:"Tolstoy"
85- | RERANK "war and peace" ON title inferenceId=test_reranker
86- | KEEP book_no, title, author
132+ | RERANK "war and peace" ON title WITH inferenceId=test_reranker
133+ | EVAL _score=ROUND(_score, 2)
134+ | KEEP book_no, title, author, _score
87135| SORT author, title
88136| LIMIT 3
89137;
90138
91- book_no:keyword | title:text | author:text
92- 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy]
93- 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy
94- 5327 | War and Peace | Leo Tolstoy
139+ book_no:keyword | title:text | author:text | _score:double
140+ 4536 | War and Peace (Signet Classics) | [John Hockenberry, Leo Tolstoy, Pat Conroy] | 0.03
141+ 2776 | The Devil and Other Stories (Oxford World's Classics) | Leo Tolstoy | 0.02
142+ 5327 | War and Peace | Leo Tolstoy | 0.08
95143;
96144
97145
@@ -105,12 +153,14 @@ FROM books METADATA _id, _index, _score
105153| FORK ( WHERE title:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
106154 ( WHERE author:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
107155| RRF
108- | RERANK "Tolkien" ON title inferenceId=test_reranker
156+ | RERANK "Tolkien" ON title WITH inferenceId=test_reranker
157+ | EVAL _score=ROUND(_score, 2)
158+ | SORT _score DESC, book_no ASC
109159| LIMIT 2
110- | KEEP book_no, title, author
160+ | KEEP book_no, title, author, _score
111161;
112162
113- book_no:keyword | title:keyword | author:keyword
114- 5335 | Letters of J R R Tolkien | J.R.R. Tolkien
115- 2130 | The J. R. R. Tolkien Audio Collection | [Christopher Tolkien, John Ronald Reuel Tolkien]
163+ book_no:keyword | title:keyword | author:keyword | _score:double
164+ 5335 | Letters of J R R Tolkien | J.R.R. Tolkien | 0.04
165+ 2130 | The J. R. R. Tolkien Audio Collection | [Christopher Tolkien, John Ronald Reuel Tolkien] | 0.03
116166;
0 commit comments