public class LuceneIndexProvider extends IndexProvider
IndexProvider
implementation which uses the Apache Lucene library.IndexProvider.ManagedIndexOperation
DEFAULT_BATCH_SIZE
Constructor and Description |
---|
LuceneIndexProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
doInitialize()
Method that should do the provider-specific initialization work.
|
protected IndexUsage |
evaluateUsage(QueryContext context,
IndexCostCalculator calculator,
IndexDefinition defn)
Returns an object which is used during the planning phase to evaluate if a certain index should be used or not.
|
protected int |
getCostEstimate()
Returns a positive number representing the cost estimate of using indexes from this provider.
|
protected ManagedIndexBuilder |
getIndexBuilder(IndexDefinition defn,
String workspaceName,
NodeTypes.Supplier nodeTypesSupplier,
ChangeSetAdapter.NodeTypePredicate matcher)
Offers subclasses the possibility of providing a
ManagedIndexBuilder instance which significantly simplifies the
task of creating or updating ManagedIndex instances for providers. |
Long |
getLatestIndexUpdateTime()
Return the latest time at which this provider successfully updated its indexes.
|
void |
validateProposedIndex(ExecutionContext context,
IndexDefinition defn,
NodeTypes.Supplier nodeTypesSupplier,
Problems problems)
Validate the proposed index definition, and use the supplied problems to report any issues that will prevent this provider
from creating and using an index with the given definition.
|
batchSize, context, createIndex, environment, getIndex, getIndexes, getIndexNames, getIndexPlanner, getIndexWriter, getManagedIndex, getName, getRepositoryName, initialize, isType, logger, matches, matches, names, namespaces, notify, notify, notify, onEachIndex, onEachIndexInWorkspace, planUseOfIndex, postShutdown, preShutdown, removeIndex, shutdown, updateIndex, validateDefaultColumnDefinitionType, validateDefaultColumnTypes, valueFactories
protected void doInitialize() throws RepositoryException
IndexProvider
By the time this method is called, ModeShape will hav already set the IndexProvider.context
, IndexProvider.logger
, IndexProvider.name
, and
IndexProvider.repositoryName
plus any fields that match configuration properties for the provider.
This is an excellent place for providers to validate the provider-specific fields set by ModeShape via reflection during instantiation.
doInitialize
in class IndexProvider
RepositoryException
- if there is a problem initializing the providerpublic void validateProposedIndex(ExecutionContext context, IndexDefinition defn, NodeTypes.Supplier nodeTypesSupplier, Problems problems)
IndexProvider
This should only be implemented if the provider has any particular validation requirements (for example it doesn't support
multiple columns or certain index types). The repository will perform for all index definitions some basic validations
via IndexProvider.validateDefaultColumnTypes(ExecutionContext, IndexDefinition, Problems)
validateProposedIndex
in class IndexProvider
context
- the execution context in which to perform the validation; never nulldefn
- the proposed index definition; never nullnodeTypesSupplier
- the supplier for the NodeTypes object that contains information about the currently-registered
node types; never nullproblems
- the problems that should be used to report any issues with the index definition; never nullprotected int getCostEstimate()
IndexProvider
getCostEstimate
in class IndexProvider
IndexCostCalculator.Costs
public Long getLatestIndexUpdateTime()
IndexProvider
getLatestIndexUpdateTime
in class IndexProvider
Long
instance which either contains the latest update time or null
which means that
this provider does not support incremental reindexing.protected ManagedIndexBuilder getIndexBuilder(IndexDefinition defn, String workspaceName, NodeTypes.Supplier nodeTypesSupplier, ChangeSetAdapter.NodeTypePredicate matcher)
IndexProvider
ManagedIndexBuilder
instance which significantly simplifies the
task of creating or updating ManagedIndex
instances for providers.
If a provider chooses to override this method, it does not have to override
the #createIndex(IndexDefinition, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
method or
the #updateIndex(IndexDefinition, IndexDefinition, ManagedIndex, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
method, as the builder instance will be used to create specific indexes and adapters, based on the index definition.
Providers can also choose to ignore this method, in which case they will have to override the
#createIndex(IndexDefinition, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
and
#updateIndex(IndexDefinition, IndexDefinition, ManagedIndex, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
methods.
getIndexBuilder
in class IndexProvider
defn
- the definition of the index; never nullworkspaceName
- the name of the actual workspace to which the new index applies; never nullnodeTypesSupplier
- the supplier for the current node types cache; never nullmatcher
- the node type matcher used to determine which nodes should be included in the index, and which automatically
updates when node types are changed in the repository; may not be nullManagedIndexBuilder
instance, or null
(the default) which indicates that a provider chooses to
ovveride both the createIndex and updateIndex methods.protected IndexUsage evaluateUsage(QueryContext context, IndexCostCalculator calculator, IndexDefinition defn)
IndexProvider
evaluateUsage
in class IndexProvider
context
- the context of the original query; never nullcalculator
- the calculator that should be used to record plan information for the index; never nulldefn
- the definition for the index; never nullIndexUsage
instance, or null
which is the default and which indicates that a provider chooses
to override the IndexProvider.planUseOfIndex(QueryContext, IndexCostCalculator, String, ManagedIndex, IndexDefinition)
methodIndexProvider.planUseOfIndex(QueryContext, IndexCostCalculator, String, ManagedIndex, IndexDefinition)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.