|
104 | 104 | import static org.hamcrest.Matchers.containsString; |
105 | 105 | import static org.hamcrest.Matchers.empty; |
106 | 106 | import static org.hamcrest.Matchers.equalTo; |
107 | | -import static org.hamcrest.Matchers.hasItem; |
108 | 107 | import static org.hamcrest.Matchers.hasSize; |
109 | 108 | import static org.hamcrest.Matchers.instanceOf; |
110 | 109 | import static org.hamcrest.Matchers.is; |
111 | | -import static org.hamcrest.Matchers.matchesRegex; |
112 | 110 | import static org.hamcrest.Matchers.not; |
113 | 111 | import static org.hamcrest.Matchers.notNullValue; |
114 | 112 | import static org.hamcrest.Matchers.startsWith; |
@@ -3106,7 +3104,8 @@ public void testResolveRerankInferenceId() { |
3106 | 3104 | assertThat( |
3107 | 3105 | ve.getMessage(), |
3108 | 3106 | containsString( |
3109 | | - "cannot use inference endpoint [completion-inference-id] with task type [completion] within a Rerank command. Only inference endpoints with the task type [rerank] are supported" |
| 3107 | + "cannot use inference endpoint [completion-inference-id] with task type [completion] within a Rerank command. " |
| 3108 | + + "Only inference endpoints with the task type [rerank] are supported" |
3110 | 3109 | ) |
3111 | 3110 | ); |
3112 | 3111 | } |
@@ -3160,21 +3159,18 @@ public void testResolveRerankFields() { |
3160 | 3159 |
|
3161 | 3160 | { |
3162 | 3161 | // Multiple fields. |
3163 | | - LogicalPlan plan = analyze( |
3164 | | - """ |
3165 | | - FROM books |
3166 | | - | WHERE title:"italian food recipe" |
3167 | | - | RERANK "italian food recipe" ON title, description=SUBSTRING(description, 0, 100), yearRenamed=year WITH "reranking-inference-id" |
3168 | | - """, |
3169 | | - "mapping-books.json" |
3170 | | - ); |
| 3162 | + LogicalPlan plan = analyze(""" |
| 3163 | + FROM books |
| 3164 | + | WHERE title:"food" |
| 3165 | + | RERANK "food" ON title, description=SUBSTRING(description, 0, 100), yearRenamed=year WITH "reranking-inference-id" |
| 3166 | + """, "mapping-books.json"); |
3171 | 3167 |
|
3172 | 3168 | Limit limit = as(plan, Limit.class); // Implicit limit added by AddImplicitLimit rule. |
3173 | 3169 | Rerank rerank = as(limit.child(), Rerank.class); |
3174 | 3170 | Filter filter = as(rerank.child(), Filter.class); |
3175 | 3171 | EsRelation relation = as(filter.child(), EsRelation.class); |
3176 | 3172 |
|
3177 | | - assertThat(rerank.queryText(), equalTo(string("italian food recipe"))); |
| 3173 | + assertThat(rerank.queryText(), equalTo(string("food"))); |
3178 | 3174 | assertThat(rerank.inferenceId(), equalTo(string("reranking-inference-id"))); |
3179 | 3175 |
|
3180 | 3176 | assertThat(rerank.rerankFields(), hasSize(3)); |
|
0 commit comments