Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Very simple query
select n.* from [nt:hierarchyNode] as n where ISCHILDNODE(n, '/myfolder');
Executed up to 40 seconds on Repository with ~5000 files and ~7000 folders. When similar query on the same repo
select n.* from [nt:hierarchyNode] as n where ISDESCENDANTNODE(n, '/myfolder')
took only ~20ms.
According to logs it looks like query with ISCHILDNODE traversing all repository - not only "/myfolder" but all the rest folders.
I found myself that problem might be in
org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy:PathIterator
PathIterator(Filter filter, String indexName, String pathPrefix, boolean prependPathPrefix) { this.filter = filter; this.pathPrefix = pathPrefix; this.indexName = indexName; boolean shouldDescendDirectly = filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN);
I'm pretty sure that shouldDescendDirectly should be true also for .DIRECT_CHILDREN.
I even tested it in debug mode and changed value in runtime. Query executed correctly with acceptable speed.