Skip to content

Commit 51b6066

Browse files
carlosdelestjoshua-adams-1
authored andcommitted
ESQL - full text functions verifier tests refactor (elastic#128775)
1 parent 0f44bd4 commit 51b6066

File tree

4 files changed

+308
-621
lines changed

4 files changed

+308
-621
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"properties": {
3+
"id": {
4+
"type": "integer"
5+
},
6+
"title": {
7+
"type": "text"
8+
},
9+
"body": {
10+
"type": "text"
11+
},
12+
"tags": {
13+
"type": "keyword"
14+
},
15+
"category": {
16+
"type": "integer"
17+
},
18+
"published_date": {
19+
"type": "date"
20+
},
21+
"vector": {
22+
"type": "dense_vector",
23+
"similarity": "l2_norm"
24+
}
25+
}
26+
}

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -204,23 +204,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Failures failu
204204
checkCommandsBeforeExpression(
205205
plan,
206206
condition,
207-
Match.class,
208-
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
209-
m -> "[" + m.functionName() + "] " + m.functionType(),
210-
failures
211-
);
212-
checkCommandsBeforeExpression(
213-
plan,
214-
condition,
215-
MultiMatch.class,
216-
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
217-
m -> "[" + m.functionName() + "] " + m.functionType(),
218-
failures
219-
);
220-
checkCommandsBeforeExpression(
221-
plan,
222-
condition,
223-
Term.class,
207+
FullTextFunction.class,
224208
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
225209
m -> "[" + m.functionName() + "] " + m.functionType(),
226210
failures

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
@@ -379,7 +379,7 @@ public String functionName() {
379379
private TypeResolution resolveFields() {
380380
return fields.stream()
381381
.map(
382-
(Expression field) -> isNotNull(field, sourceText(), FIRST).and(
382+
(Expression field) -> isNotNull(field, sourceText(), SECOND).and(
383383
isType(
384384
field,
385385
FIELD_DATA_TYPES::contains,

0 commit comments

Comments
 (0)