• Unlike Jackrabbit 2, Oak does not index content by default. If there is no index for a specific query, possibly many nodes will be traversed. The query may still work but probably be very slow.
For example, you can proceed query as below:
SELECT * FROM [cq:PageContent] WHERE [jcr:title] IS NOT NULL
In CRXDE | Lite with Type = SQL2 (Oak)
Or access Query Performance:
As you can see here, Oak normally encounters a query without an index, a WARN level log message as below:
The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.
In addition, you can take advantage Oak SQL-2 query grammar to create an example as below:
SELECT * FROM [cq:PageContent] WHERE ISDESCENDANTNODE([/conf/flagtick])
Use http://oakutils.appspot.com/generate/index to generate Oak indexes.
- compatVersion = 2
- async = "async"
- jcr:primaryType = oak:QueryIndexDefinition
- evaluatePathRestrictions = true
- type = "lucene"
+ indexRules
+ cq:PageContent
+ properties
+ primaryType
- name = "jcr:primaryType"
- propertyIndex = true
If you look at http://localhost:4502/crx/explorer/nodetypes/index.jsp and aware of that cq:PageContent is inherited from nt:base. Hence, the query can be modified as below:
SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE([/conf/flagtick])
Upon execute the above query, you will get further results out of scope cq:PageContent. One of results come is /conf/flagtick/settings. Why the folder settings have already existed because of jcr:primaryType = sling:Folder.