Configuring the indexes
If reindexing is needed in large repositories, specially when using MongoDB and for full-text indexes, consider text pre-extraction, and using oak-run to build the initial index and to reindex.
Indexes are configured as nodes in the repository under the Oak:index node.
The type of the index node must be oak:QueryIndexDefinition. Several configuration options are available for each indexer as node properties. For more information, see the configuration details for each indexer type below.
The Property Index
The Property Index is useful for queries that have property constraints but are not full-text. It can be configured by following the below procedure:
-
Open CRXDE by going to
http://localhost:4502/crx/de/index.jsp
-
Create a node under oak:index
-
Name the node PropertyIndex, and set the node type to oak:QueryIndexDefinition
-
Set the following properties for the new node:
- type:
property
(of type String) - propertyNames:
jcr:uuid
(of type Name)
This particular example indexes the
jcr:uuid
property, whose job is to expose the universally unique identifier (UUID) of the node it is attached to. - type:
-
Save the changes.
The Property Index has the following configuration options:
-
The type property specifies the type of index, and in this case it must be set to property
-
The propertyNames property indicates the list of the properties that are stored in the index. In case it is missing, the node name is used as a property name reference value. In this example, the jcr:uuid property whose job is to expose the unique identifier (UUID) of its node is added to the index.
-
The unique flag which, if set to true adds a uniqueness constraint on the property index.
-
The declaringNodeTypes property lets you specify a certain node type that the index only applies to.
-
The reindex flag which if set to true, triggers a full content reindex.
The Ordered Index
The Ordered index is an extension of the Property index. However, it has been deprecated. Indexes of this type must be replaced with the Lucene Property Index.
The Lucene Full Text Index
A full text indexer based on Apache Lucene is available in AEM 6.
If a full-text index is configured, all queries that have a full-text condition use the full-text index, no matter if there are other conditions that are indexed, and no matter if there is a path restriction.
If no full-text index is configured, then queries with full-text conditions do not work as expected.
Because the index is updated by way of an asynchronous background thread, some full-text searches are unavailable for a small window of time until the background processes are finished.
You can configure a Lucene full-text index by following the below procedure:
-
Open CRXDE and create a node under oak:index.
-
Name the node LuceneIndex and set the node type to oak:QueryIndexDefinition
-
Add the following properties to the node:
- type:
lucene
(of type String) - async:
async
(of type String)
- type:
-
Save the changes.
The Lucene Index has the following configuration options:
- The type property which specifies the type of index must be set to lucene
- The async property which must be set to async. This sends the index update process to a background thread.
- The includePropertyTypes property, which defines what subset of property types are included in the index.
- The excludePropertyNames property which defines a list of property names - properties that should be excluded from the index.
- The reindex flag which when set to true, triggers a full content reindex.