Class LucenePropertyIndex

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

    public class LucenePropertyIndex
    extends org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex
    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");
         index.child("lucene")
             .setProperty("jcr:primaryType", "oak:QueryIndexDefinition", Type.NAME)
             .setProperty("type", "lucene")
             .setProperty("async", "async")
             .setProperty("reindex", "true");
     }
     
    See Also:
    QueryIndex
    • Field Detail

      • OLD_FACET_PROVIDER_CONFIG_NAME

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

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

        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).
        Returns:
        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.

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

        @NotNull
        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.
        Parameters:
        qs - the list of queries. Cannot be null.
        Returns:
        the request facade