Hello,
with the following query I am able to get file nodes ordered by name:
SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER
BY NAME([s]) DESC
unfortunately, because I do not have an index, on a big repository I have
warnings like:
WARN org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor -
Traversed 81000 nodes with filter Filter(query=SELECT * FROM [nt:file] AS s
WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY NAME([s]) DESC,
path=/repo1/pruebaJF1/*); consider creating an index or changing the query
and the query takes a lot of time.
I do not know how to define a proper index for name(). if I use the
following:
- compatVersion = 2
- async = "async"
- jcr:primaryType = oak:QueryIndexDefinition
- evaluatePathRestrictions = true
- type = "lucene"
+ indexRules
+ nt:file
+ properties
+ primaryType
- name = "jcr:primaryType"
- propertyIndex = true
+ name
- function = "fn:name"
- ordered = true
- type = "String"
the index is used (index cost is 501 compared to 80946 for traverse), but
it takes more time than traversing with warnings like:
WARN
org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextPathCursor
- Index-Traversed 80000 nodes with filter Filter(query=SELECT * FROM
[nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY NAME([s])
DESC, path=/repo1/pruebaJF1/*)
Thanks in advance.
Regards.
Jorge