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.FulltextIndexUsed to query new (compatVersion 2) Lucene indexes. Provides a QueryIndex that does lookups against a Lucene-based indexTo define a lucene index on a subtree you have to add an
oak:indexnode. Under it follows the index definition node that:- must be of type
oak:QueryIndexDefinition - must have the
typeproperty set tolucene - must have the
asyncproperty set toasync
Optionally you can add
- what subset of property types to be included in the index via the
includePropertyTypesproperty - a blacklist of property names: what property to be excluded from the index via the
excludePropertyNamesproperty - the
reindexflag which when set totrue, 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex
org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex.Facet, org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex.FacetProvider, org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex.FulltextResultRow, org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex.IteratorRewoundStateProvider
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.spi.query.QueryIndex
QueryIndex.AdvancedQueryIndex, QueryIndex.AdvanceFulltextQueryIndex, QueryIndex.FulltextQueryIndex, QueryIndex.IndexPlan, QueryIndex.NativeQueryIndex, QueryIndex.NodeAggregator, QueryIndex.OrderEntry
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCACHE_FACET_RESULTS_NAMEstatic intLUCENE_QUERY_BATCH_SIZEBatch size for fetching results from Lucene queries.static java.lang.StringOLD_FACET_PROVIDER_CONFIG_NAME
-
Constructor Summary
Constructors Constructor Description LucenePropertyIndex(IndexTracker tracker)LucenePropertyIndex(IndexTracker tracker, IndexAugmentorFactory augmentorFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetIndexName()Get the generic index name (normally the index type).doublegetMinimumCost()Returns the minimum cost whichQueryIndex.getCost(Filter, NodeState)would return in the best possible case.static @NotNull org.apache.jackrabbit.oak.plugins.index.lucene.LuceneRequestFacade<Query>performAdditionalWraps(@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.Cursorquery(QueryIndex.IndexPlan plan, NodeState rootState)Start a query.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex
determinePropertyType, getCost, getNodeAggregator, getPathRestriction, getPlan, getPlanDescription, getPlans, isNodePath, parseFacetField, query
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.spi.query.QueryIndex
getIndexName
-
-
-
-
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
-
-
Constructor Detail
-
LucenePropertyIndex
public LucenePropertyIndex(IndexTracker tracker)
-
LucenePropertyIndex
public LucenePropertyIndex(IndexTracker tracker, IndexAugmentorFactory augmentorFactory)
-
-
Method Detail
-
getMinimumCost
public double getMinimumCost()
Description copied from interface:QueryIndexReturns the minimum cost whichQueryIndex.getCost(Filter, NodeState)would return in the best possible case.The implementation should return a static/cached value because it is called very often.
- Returns:
- the minimum cost for the index
-
getIndexName
public java.lang.String getIndexName()
Description copied from interface:QueryIndexGet 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.AdvancedQueryIndexStart 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 userootState- 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
-
-