Class LucenePropertyIndex

java.lang.Object
org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex
org.apache.jackrabbit.oak.plugins.index.lucene.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:
  • Field Details

    • OLD_FACET_PROVIDER_CONFIG_NAME

      public static final String OLD_FACET_PROVIDER_CONFIG_NAME
      See Also:
    • CACHE_FACET_RESULTS_NAME

      public static final String CACHE_FACET_RESULTS_NAME
      See Also:
    • EAGER_FACET_CACHE_FILL_NAME

      public static final String EAGER_FACET_CACHE_FILL_NAME
      See Also:
    • LUCENE_QUERY_BATCH_SIZE

      public static final int LUCENE_QUERY_BATCH_SIZE
      Batch size for fetching results from Lucene queries.
      See Also:
  • Constructor Details

  • Method Details

    • getIndexName

      public 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 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