in oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java [550:673]
private ConstraintImpl parseConditionFunctionIf(String functionName) throws ParseException {
ConstraintImpl c;
if ("CONTAINS".equalsIgnoreCase(functionName)) {
if (readIf("*")) {
// strictly speaking, CONTAINS(*, ...) is not supported
// according to the spec:
// "If only one selector exists in this query, explicit
// specification of the selectorName preceding the
// propertyName is optional"
// but we anyway support it
read(",");
c = factory.fullTextSearch(
getOnlySelectorName(), null, parseStaticOperand());
} else if (readIf(".")) {
if (!supportSQL1) {
throw getSyntaxError("selector name, property name, or *");
}
read(",");
c = factory.fullTextSearch(
getOnlySelectorName(), null, parseStaticOperand());
} else {
String name = readName();
if (readIf(".")) {
if (readIf("*")) {
read(",");
c = factory.fullTextSearch(
name, null, parseStaticOperand());
} else {
String selector = name;
name = readName();
read(",");
c = factory.fullTextSearch(
selector, name, parseStaticOperand());
}
} else {
read(",");
c = factory.fullTextSearch(
getOnlySelectorName(), name,
parseStaticOperand());
}
}
} else if ("ISSAMENODE".equalsIgnoreCase(functionName)) {
String name = readName();
if (readIf(",")) {
c = factory.sameNode(name, readAbsolutePath());
} else {
c = factory.sameNode(getOnlySelectorName(), name);
}
} else if ("ISCHILDNODE".equalsIgnoreCase(functionName)) {
String name = readName();
if (readIf(",")) {
c = factory.childNode(name, readAbsolutePath());
} else {
c = factory.childNode(getOnlySelectorName(), name);
}
} else if ("ISDESCENDANTNODE".equalsIgnoreCase(functionName)) {
String name = readName();
if (readIf(",")) {
c = factory.descendantNode(name, readAbsolutePath());
} else {
c = factory.descendantNode(getOnlySelectorName(), name);
}
} else if ("SIMILAR".equalsIgnoreCase(functionName)) {
if (readIf(".") || readIf("*")) {
read(",");
c = factory.similar(
getOnlySelectorName(), null, parseStaticOperand());
} else {
String name = readName();
if (readIf(".")) {
if (readIf("*")) {
read(",");
c = factory.fullTextSearch(
name, null, parseStaticOperand());
} else {
String selector = name;
name = readName();
read(",");
c = factory.fullTextSearch(
selector, name, parseStaticOperand());
}
} else {
read(",");
c = factory.fullTextSearch(
getOnlySelectorName(), name,
parseStaticOperand());
}
}
} else if ("NATIVE".equalsIgnoreCase(functionName)) {
LOG.warn("Native queries are deprecated. Query:{}", statement);
String selectorName;
if (currentTokenType == IDENTIFIER) {
selectorName = readName();
read(",");
} else {
selectorName = getOnlySelectorName();
}
String language = readString().getValue(Type.STRING);
read(",");
c = factory.nativeFunction(selectorName, language, parseStaticOperand());
} else if ("SPELLCHECK".equalsIgnoreCase(functionName)) {
String selectorName;
if (currentTokenType == IDENTIFIER) {
selectorName = readName();
read(",");
} else {
selectorName = getOnlySelectorName();
}
c = factory.spellcheck(selectorName, parseStaticOperand());
} else if ("SUGGEST".equalsIgnoreCase(functionName)) {
String selectorName;
if (currentTokenType == IDENTIFIER) {
selectorName = readName();
read(",");
} else {
selectorName = getOnlySelectorName();
}
c = factory.suggest(selectorName, parseStaticOperand());
} else {
return null;
}
read(")");
return c;
}