ChlineSaurus commented on code in PR #3250:
URL: https://github.com/apache/jackrabbit-oak/pull/3250#discussion_r4440288285
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryEngineSettings.java:
##########
@@ -73,6 +73,9 @@ public class QueryEngineSettings implements
QueryEngineSettingsMBean, QueryLimit
public static final String FT_XML_NAME_CHARS_IN_PATH = "FT_OAK-12364";
+ public static final String FT_EMPTY_NODE_NAME_RESTRICTION_LEGACY_MODE =
+ "FT_EMPTY_NODE_NAME_RESTRICTION_LEGACY_MODE";
Review Comment:
I so far always used the oak issue as the feature toggle name (because most
other toggles do it like this). I'm not against giving them more descriptive
names, however, maybe still add the issue somewhere in addition?
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java:
##########
@@ -97,6 +97,15 @@ public void restrict(FilterImpl f, Operator operator,
PropertyValue v) {
return;
}
String name = getName(query, v);
+ if (name == null && supportedOperator(operator) &&
v.getValue(Type.STRING).isEmpty()
+ && !f.testPath("/") && f.getSelector().equals(selector)
+ && query.getSettings().isEmptyNodeNameRestrictionEnabled()) {
+ // Only the root has an empty name; use an impossible name when it
is excluded.
+ PropertyValue impossibleName = PropertyValues.newString(":");
+ f.restrictProperty(QueryConstants.RESTRICTION_LOCAL_NAME,
Operator.EQUAL, impossibleName);
+ f.restrictProperty(QueryConstants.FUNCTION_RESTRICTION_PREFIX +
getFunction(f.getSelector()),
+ Operator.EQUAL, impossibleName, PropertyType.STRING);
+ }
Review Comment:
One additional thing my AI review mentioned (not blocking, and not yet
validated from my side):
oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
in the restrict(...) method at lines 90–108 suffers from almost the same
issue, and could be fixed almost the same way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]