|
@@ -1223,6 +1223,9 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFieldBasedWithNonIndexedColumn(":", "text : \"cat\"", "operator");
|
|
|
checkFieldBasedFunctionNotAllowedAfterCommands(":", "operator", "title : \"Meditation\"");
|
|
|
|
|
|
+ checkFieldBasedWithNonIndexedColumn("MatchPhrase", "match_phrase(text, \"cat\")", "function");
|
|
|
+ checkFieldBasedFunctionNotAllowedAfterCommands("MatchPhrase", "function", "match_phrase(title, \"Meditation\")");
|
|
|
+
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFieldBasedWithNonIndexedColumn("MultiMatch", "multi_match(\"cat\", text)", "function");
|
|
|
checkFieldBasedFunctionNotAllowedAfterCommands("MultiMatch", "function", "multi_match(\"Meditation\", title)");
|
|
@@ -1231,10 +1234,6 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFieldBasedWithNonIndexedColumn("Term", "term(text, \"cat\")", "function");
|
|
|
checkFieldBasedFunctionNotAllowedAfterCommands("Term", "function", "term(title, \"Meditation\")");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFieldBasedWithNonIndexedColumn("MatchPhrase", "match_phrase(text, \"cat\")", "function");
|
|
|
- checkFieldBasedFunctionNotAllowedAfterCommands("MatchPhrase", "function", "match_phrase(title, \"Meditation\")");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFieldBasedFunctionNotAllowedAfterCommands(String functionName, String functionType, String functionInvocation) {
|
|
@@ -1358,15 +1357,13 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionsOnlyAllowedInWhere(":", "title:\"Meditation\"", "operator");
|
|
|
checkFullTextFunctionsOnlyAllowedInWhere("QSTR", "qstr(\"Meditation\")", "function");
|
|
|
checkFullTextFunctionsOnlyAllowedInWhere("KQL", "kql(\"Meditation\")", "function");
|
|
|
+ checkFullTextFunctionsOnlyAllowedInWhere("MatchPhrase", "match_phrase(title, \"Meditation\")", "function");
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsOnlyAllowedInWhere("Term", "term(title, \"Meditation\")", "function");
|
|
|
}
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsOnlyAllowedInWhere("MultiMatch", "multi_match(\"Meditation\", title, body)", "function");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFullTextFunctionsOnlyAllowedInWhere("MatchPhrase", "match_phrase(title, \"Meditation\")", "function");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFullTextFunctionsOnlyAllowedInWhere(String functionName, String functionInvocation, String functionType)
|
|
@@ -1396,15 +1393,13 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkWithFullTextFunctionsDisjunctions("title : \"Meditation\"");
|
|
|
checkWithFullTextFunctionsDisjunctions("qstr(\"title: Meditation\")");
|
|
|
checkWithFullTextFunctionsDisjunctions("kql(\"title: Meditation\")");
|
|
|
+ checkWithFullTextFunctionsDisjunctions("match_phrase(title, \"Meditation\")");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkWithFullTextFunctionsDisjunctions("multi_match(\"Meditation\", title, body)");
|
|
|
}
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
checkWithFullTextFunctionsDisjunctions("term(title, \"Meditation\")");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkWithFullTextFunctionsDisjunctions("match_phrase(title, \"Meditation\")");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkWithFullTextFunctionsDisjunctions(String functionInvocation) {
|
|
@@ -1460,15 +1455,13 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionsWithNonBooleanFunctions(":", "title:\"Meditation\"", "operator");
|
|
|
checkFullTextFunctionsWithNonBooleanFunctions("QSTR", "qstr(\"title: Meditation\")", "function");
|
|
|
checkFullTextFunctionsWithNonBooleanFunctions("KQL", "kql(\"title: Meditation\")", "function");
|
|
|
+ checkFullTextFunctionsWithNonBooleanFunctions("MatchPhrase", "match_phrase(title, \"Meditation\")", "function");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsWithNonBooleanFunctions("MultiMatch", "multi_match(\"Meditation\", title, body)", "function");
|
|
|
}
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsWithNonBooleanFunctions("Term", "term(title, \"Meditation\")", "function");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFullTextFunctionsWithNonBooleanFunctions("MatchPhrase", "match_phrase(title, \"Meditation\")", "function");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFullTextFunctionsWithNonBooleanFunctions(String functionName, String functionInvocation, String functionType) {
|
|
@@ -1530,15 +1523,13 @@ public class VerifierTests extends ESTestCase {
|
|
|
public void testFullTextFunctionsTargetsExistingField() throws Exception {
|
|
|
testFullTextFunctionTargetsExistingField("match(title, \"Meditation\")");
|
|
|
testFullTextFunctionTargetsExistingField("title : \"Meditation\"");
|
|
|
+ testFullTextFunctionTargetsExistingField("match_phrase(title, \"Meditation\")");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
testFullTextFunctionTargetsExistingField("multi_match(\"Meditation\", title)");
|
|
|
}
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
testFullTextFunctionTargetsExistingField("term(fist_name, \"Meditation\")");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- testFullTextFunctionTargetsExistingField("match_phrase(title, \"Meditation\")");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void testFullTextFunctionTargetsExistingField(String functionInvocation) throws Exception {
|
|
@@ -2060,12 +2051,10 @@ public class VerifierTests extends ESTestCase {
|
|
|
public void testFullTextFunctionOptions() {
|
|
|
checkOptionDataTypes(Match.ALLOWED_OPTIONS, "FROM test | WHERE match(title, \"Jean\", {\"%s\": %s})");
|
|
|
checkOptionDataTypes(QueryString.ALLOWED_OPTIONS, "FROM test | WHERE QSTR(\"title: Jean\", {\"%s\": %s})");
|
|
|
+ checkOptionDataTypes(MatchPhrase.ALLOWED_OPTIONS, "FROM test | WHERE MATCH_PHRASE(title, \"Jean\", {\"%s\": %s})");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkOptionDataTypes(MultiMatch.OPTIONS, "FROM test | WHERE MULTI_MATCH(\"Jean\", title, body, {\"%s\": %s})");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkOptionDataTypes(MatchPhrase.ALLOWED_OPTIONS, "FROM test | WHERE MATCH_PHRASE(title, \"Jean\", {\"%s\": %s})");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2120,15 +2109,13 @@ public class VerifierTests extends ESTestCase {
|
|
|
public void testFullTextFunctionCurrentlyUnsupportedBehaviour() throws Exception {
|
|
|
testFullTextFunctionsCurrentlyUnsupportedBehaviour("match(title, \"Meditation\")");
|
|
|
testFullTextFunctionsCurrentlyUnsupportedBehaviour("title : \"Meditation\"");
|
|
|
+ testFullTextFunctionsCurrentlyUnsupportedBehaviour("match_phrase(title, \"Meditation\")");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
testFullTextFunctionsCurrentlyUnsupportedBehaviour("multi_match(\"Meditation\", title)");
|
|
|
}
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
testFullTextFunctionsCurrentlyUnsupportedBehaviour("term(title, \"Meditation\")");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- testFullTextFunctionsCurrentlyUnsupportedBehaviour("match_phrase(title, \"Meditation\")");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void testFullTextFunctionsCurrentlyUnsupportedBehaviour(String functionInvocation) throws Exception {
|
|
@@ -2143,6 +2130,8 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionNullArgs("match(title, null)", "second");
|
|
|
checkFullTextFunctionNullArgs("qstr(null)", "");
|
|
|
checkFullTextFunctionNullArgs("kql(null)", "");
|
|
|
+ checkFullTextFunctionNullArgs("match_phrase(null, \"query\")", "first");
|
|
|
+ checkFullTextFunctionNullArgs("match_phrase(title, null)", "second");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionNullArgs("multi_match(null, title)", "first");
|
|
|
checkFullTextFunctionNullArgs("multi_match(\"query\", null)", "second");
|
|
@@ -2151,10 +2140,6 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionNullArgs("term(null, \"query\")", "first");
|
|
|
checkFullTextFunctionNullArgs("term(title, null)", "second");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFullTextFunctionNullArgs("match_phrase(null, \"query\")", "first");
|
|
|
- checkFullTextFunctionNullArgs("match_phrase(title, null)", "second");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFullTextFunctionNullArgs(String functionInvocation, String argOrdinal) throws Exception {
|
|
@@ -2168,6 +2153,7 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionsConstantQuery("match(title, category)", "second");
|
|
|
checkFullTextFunctionsConstantQuery("qstr(title)", "");
|
|
|
checkFullTextFunctionsConstantQuery("kql(title)", "");
|
|
|
+ checkFullTextFunctionsConstantQuery("match_phrase(title, tags)", "second");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsConstantQuery("multi_match(category, body)", "first");
|
|
|
checkFullTextFunctionsConstantQuery("multi_match(concat(title, \"world\"), title)", "first");
|
|
@@ -2175,9 +2161,6 @@ public class VerifierTests extends ESTestCase {
|
|
|
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsConstantQuery("term(title, tags)", "second");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFullTextFunctionsConstantQuery("match_phrase(title, tags)", "second");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFullTextFunctionsConstantQuery(String functionInvocation, String argOrdinal) throws Exception {
|
|
@@ -2201,12 +2184,10 @@ public class VerifierTests extends ESTestCase {
|
|
|
checkFullTextFunctionsInStats("title : \"Meditation\"");
|
|
|
checkFullTextFunctionsInStats("qstr(\"title: Meditation\")");
|
|
|
checkFullTextFunctionsInStats("kql(\"title: Meditation\")");
|
|
|
+ checkFullTextFunctionsInStats("match_phrase(title, \"Meditation\")");
|
|
|
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
|
|
|
checkFullTextFunctionsInStats("multi_match(\"Meditation\", title, body)");
|
|
|
}
|
|
|
- if (EsqlCapabilities.Cap.MATCH_PHRASE_FUNCTION.isEnabled()) {
|
|
|
- checkFullTextFunctionsInStats("match_phrase(title, \"Meditation\")");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void checkFullTextFunctionsInStats(String functionInvocation) {
|