Class LucenePropertyIndex

  • All Implemented Interfaces:
    QueryIndex, QueryIndex.AdvancedQueryIndex, QueryIndex.AdvanceFulltextQueryIndex, QueryIndex.FulltextQueryIndex, QueryIndex.NativeQueryIndex

    public class LucenePropertyIndex
    Used to query new (compatVersion 2) Lucene indexes. Provides a QueryIndex that does lookups against a Lucene-based index

    To define a lucene 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 lucene
    • must have the async property set to async

    Optionally you can add

    • what subset of property types to be included in the index via the includePropertyTypes property
    • a blacklist of property names: what property to be excluded from the index via the excludePropertyNames property
    • the reindex flag which when set to true, triggers a full content re-index.
         NodeBuilder index = root.child("oak:index");
             .setProperty("jcr:primaryType", "oak:QueryIndexDefinition", Type.NAME)
             .setProperty("type", "lucene")
             .setProperty("async", "async")
             .setProperty("reindex", "true");
    See Also:
    • Field Detail


        public static final java.lang.String OLD_FACET_PROVIDER_CONFIG_NAME
        See Also:
        Constant Field Values

        public static final java.lang.String CACHE_FACET_RESULTS_NAME
        See Also:
        Constant Field Values

        public static final int LUCENE_QUERY_BATCH_SIZE
        Batch size for fetching results from Lucene queries.
        See Also:
        Constant Field Values
    • Method Detail

      • getIndexName

        public java.lang.String getIndexName()
        Description copied from interface: QueryIndex
        Get the generic index name (normally the index type).
        the index name
      • query

        public Cursor query​(QueryIndex.IndexPlan plan,
                            NodeState rootState)
        Description copied from interface: QueryIndex.AdvancedQueryIndex
        Start a query. The filter and sort order of the index plan is to be used.

        The index plan is one of the plans that the index returned in the getPlans call.

        plan - the index plan to use
        rootState - root state of the current repository snapshot
        a cursor to iterate over the result
      • performAdditionalWraps

        public static @NotNull org.apache.jackrabbit.oak.plugins.index.lucene.LuceneRequestFacade<Query> performAdditionalWraps​(@NotNull
                                                                                                                                @NotNull java.util.List<Query> qs)
        Perform additional wraps on the list of queries to allow, for example, the NOT CONTAINS to play properly when sent to lucene.
        qs - the list of queries. Cannot be null.
        the request facade