The Chapter links below assume the Initial Packages are installed on AEM Author at http://localhost:4502
Corrections and Follow-up
Corrections and clarifications from the lab discussions and answers to follow-up questions from attendees.
Re-indexing can be stopped via the IndexStats MBean available via AEM Web Console > JMX
- Execute abortAndPause() to abort the re-indexing. This will lock the index to further re-indexing until resume() is invoked
- Executing resume() will restart the indexing process.
- Documentation: http://jackrabbit.apache.org/oak/docs/query/indexing.html#async-index-mbean
Oak supports placing indexes through-out the content tree, and these indexes will only index within that sub-tree. For example /content/site-a/oak:index/cqPageLucene could be create to index content only under /content/site-a.
An equivalent approach is to use the includePaths and queryPaths properties on an index under /oak:index. For example:
The considerations with this approach are:
- Queries MUST specify a path restriction that is equal to the index's query path scope, or be a descendant there of.
- Broader scoped indexes (for example /oak:index/cqPageLucene) will ALSO index the data, resulting in duplicative-ingestion and disk use cost.
- May require duplicative configuration managment (ex. adding the same indexRules across multiple tenant indexes if they must satisfy the same query sets)
- This approach is best served on the AEM Publish tier for custom site search, as on AEM Author, it is common for queries to be executed at high up the content tree for different tenants (for example, via Omnisearch) - different index definitions can result in different behavior based only on the path restriction.
New in AEM 6.3 is the ability to query for mutiple node-types in the same provided query. The following QueryBuilder query. Note that each "sub-query" can resolve to its own index, so in this example, the cq:Page sub-query resolves to /oak:index/cqPageLucene and the dam:Asset sub-query resolves to /oak:index/damAssetLucene.
group.p.or=true group.1_group.type=cq:Page # add all page restrictions to this group group.2_group.type=dam:Asset # add all asset restrictions to this group
QUERY:(//element(*, cq:Page) | //element(*, dam:Asset)) PLAN: [cq:Page] as [a] /* lucene:cqPageLucene(/oak:index/cqPageLucene) *:* */ union [dam:Asset] as [a] /* lucene:damAssetLucene(/oak:index/damAssetLucene) *:* */
New in AEM 6.3 is the ability to query across mutiple paths in the same provided query. The following QueryBuilder query. Note that each "sub-query" may resolve to its own index.
This can be problematic in certain situations such as ranked results, since AEM is not able to sort ACROSS unions. Each UNION'd statement is sorted independently and then the results are concatonated together.
group.p.or=true group.1_group.type=cq:Page group.1_group.path=/content/docs/en/6-2 # add all page restrictions to this group group.2_group.type=cq:Page group.2_group.path=/content/docs/en/6-3 # add all asset restrictions to this group
QUERY: (/jcr:root/content/docs/en/_x0036_-2//element(*, cq:Page) | /jcr:root/content/docs/en/_x0036_-3//element(*, cq:Page)) PLAN: [cq:Page] as [a] /* traverse "/content/docs/en/6-2//*" where isdescendantnode([a], [/content/docs/en/6-2]) */ union [cq:Page] as [a] /* traverse "/content/docs/en/6-3//*" where isdescendantnode([a], [/content/docs/en/6-3]) */