Provides a QueryIndex that does lookups against a property index
To define a property index on a subtree you have to add an oak:index
node. Under it follows the index definition node that:
- must be of type
oak:queryIndexDefinition
- must have the
type
property set to p2
- contains the
propertyNames
property that indicates what property will be stored in the index
Optionally you can specify the uniqueness constraint on a property index by setting the unique
flag to true
.
Note: propertyNames
can be a list of properties, and it is optional.in case it is missing, the node name will be used as a property name reference value
Note: reindex
is a property that when set to true
, triggers a full content reindex.
{ NodeBuilder index = root.child("oak:index"); index.child("uuid") .setProperty("jcr:primaryType", "oak:queryIndexDefinition", Type.NAME) .setProperty("type", "p2") .setProperty("propertyNames", "jcr:uuid") .setProperty("unique", true) .setProperty("reindex", true); }
@see QueryIndex
@see Property2IndexLookup