Why do we need to index?
When a JCR query gets executed, usually it searches the index first. If there is no index, the query executes for the entire content. This is time-consuming and overhead for the AEM. But keep in mind, if the frequency of queries executed is less, we can ignore the indexing.
Let us understand the Oak and AEM indexing in detail here.
In fact, there are three main types of indexes available in Oak
· Property
· Lucene
· Solr
And below are the supported query languages from Oak
· XPath (recommended)
· SQL-2
· SQL (deprecated)
· JQOM
AEM allows writing queries in one of three ways:
· QueryBuilder APIs (recommended)
· Using XPath (recommended)
· Using SQL2
Note: all queries are converted to SQL2 before being run,
Indexing modes
Different versions of the node data are compared to find indexes. The indexing mode defines how the comparison is performed, and when the index content gets updated. Below given the indexing mode and details.
Sync Vs Async Vs Nrt
· Async - When we index in async mode, results returned by index may not always reflect the exact up to date state of the repository.
· Sync - Sync Index ensures that the index is updated as part of each commit.
· NRT - This method indicates that the index is a near-real-time index.
The flow of the index is given in the below image.
Below given various indexes in detail.
Property Index - Not a full-text indexing method. The index definition is stored in the repository itself.
Configuration
type: property;
propertyNames: jcr:uuid (of type Name)
Ordered Index - [deprecated] - This is an extension of the Property index. It keeps the order of the indexed property persistent in the repository.
Configuration
type: ordered;
propertyNames: jcr:lastModified
Lucene Full-Text Index - This is a full-text index method, which is asynchronous too.
Configuration
type: Lucene ;
async: async
Lucene Property Index - This is not full-text indexing.
Configuration
type: lucene ;
async: async ;
fulltextEnabled: false;
includePropertyNames: ["alias"]
The Solr Index - This is a full-text search but it can also be used to index search by path, property restrictions and primary type restrictions, which means the Solr index in Oak can be used for any type of JCR query.
Configuration
type:solr;
async:async;
reindex:true
Traversal Index - When no indexing is done; All content nodes are traversed to find matches to the query, slower and overhead to AEM.
A tabular version is given below
No comments:
Post a Comment
If you have any doubts or questions, please let us know.