Class SearchIndex
- java.lang.Object
-
- org.apache.jackrabbit.core.query.AbstractQueryHandler
-
- org.apache.jackrabbit.core.query.lucene.SearchIndex
-
- All Implemented Interfaces:
QueryHandler
public class SearchIndex extends AbstractQueryHandler
Implements aQueryHandlerusing Lucene.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classSearchIndex.CombinedIndexReader
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_EXTRACTOR_BACK_LOGThe default value for propertyextractorBackLog.static intDEFAULT_EXTRACTOR_POOL_SIZEDeprecated.this value is not used anymore.static longDEFAULT_EXTRACTOR_TIMEOUTThe default timeout in milliseconds which is granted to the text extraction process until fulltext indexing is deferred to a background thread.static intDEFAULT_MAX_FIELD_LENGTHthe default value for propertymaxFieldLength.static intDEFAULT_MAX_MERGE_DOCSThe default value for propertymaxMergeDocs.static intDEFAULT_MERGE_FACTORthe default value for propertymergeFactor.static intDEFAULT_MIN_MERGE_DOCSThe default value for propertyminMergeDocs.static intDEFAULT_TERM_INFOS_INDEX_DIVISORThe default value fortermInfosIndexDivisor.protected MultiIndexindexThe actual indexprotected static PathJCR_SYSTEM_PATHThe path/jcr:system.protected static PathFactoryPATH_FACTORYThe path factory.protected static PathROOT_PATHThe path of the root node.static Collection<Name>VALID_SYSTEM_INDEX_NODE_TYPE_NAMESValid node type names under /jcr:system.-
Fields inherited from class org.apache.jackrabbit.core.query.AbstractQueryHandler
fs
-
-
Constructor Summary
Constructors Constructor Description SearchIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddNode(NodeState node)Adds thenodeto the search index.protected voidcheckOpen()Checks if thisSearchIndexis open, otherwise throws anIOException.voidclose()Closes thisQueryHandlerand frees resources attached to this handler.protected DirectoryManagercreateDirectoryManager()protected DocumentcreateDocument(NodeState node, NamespaceMappings nsMappings, IndexFormatVersion indexFormatVersion)Creates a luceneDocumentfor a node state using the namespace mappingsnsMappings.ExcerptProvidercreateExcerptProvider(Query query)Creates an excerpt provider for the givenquery.ExecutableQuerycreateExecutableQuery(SessionContext sessionContext, String statement, String language)Creates a new query by specifying the query statement itself and the language in which the query is stated.protected IndexingConfigurationcreateIndexingConfiguration(NamespaceMappings namespaceMappings)protected Ordering[]createOrderings(OrderingImpl[] orderings)Creates internal orderings for the QOM ordering specifications.protected RedoLogFactorycreateRedoLogFactory()Creates a redo log factory based ongetRedoLogFactoryClass().protected SortField[]createSortFields(Path[] orderProps, boolean[] orderSpecs, String[] orderFuncs)Creates the SortFields for the order properties.protected SpellCheckercreateSpellChecker()Creates a spell checker for this query handler.protected SynonymProvidercreateSynonymProvider()protected FileSystemResourcecreateSynonymProviderConfigResource()Creates a file system resource to the synonym provider configuration.voiddeleteNode(NodeId id)Removes the node withidfrom the search index.protected voiddoInit()Initializes thisQueryHandler.MultiColumnQueryHitsexecuteQuery(SessionImpl session, AbstractQueryImpl queryImpl, Query query, Path[] orderProps, boolean[] orderSpecs, String[] orderFuncs, long resultFetchHint)Executes the query on the search index.MultiColumnQueryHitsexecuteQuery(SessionImpl session, MultiColumnQuery query, Ordering[] orderings, long resultFetchHint)Executes the query on the search index.voidflush()Waits until all pending text extraction tasks have been processed and the updated index has been flushed to disk.StringgetAnalyzer()Returns the class name of the default analyzer that is currently in use.booleangetAutoRepair()intgetBufferSize()Returns the current value for the buffer size.intgetCacheSize()DirectoryManagergetDirectoryManager()StringgetDirectoryManagerClass()booleangetEnableConsistencyCheck()StringgetExcerptProviderClass()intgetExtractorBackLogSize()intgetExtractorPoolSize()longgetExtractorTimeout()booleangetForceConsistencyCheck()StringgetForkJavaCommand()Returns the java command used to fork external parser processes, ornull(the default) for in-process text extraction.protected MultiIndexgetIndex()Returns the actual index.IndexFormatVersiongetIndexFormatVersion()Returns the index format version that this search index is able to support when a query is executed on this index.IndexingConfigurationgetIndexingConfig()StringgetIndexingConfiguration()StringgetIndexingConfigurationClass()protected ElementgetIndexingConfigurationDOM()Returns the document element of the indexing configuration ornullif there is no indexing configuration.IndexReadergetIndexReader()Returns an index reader for this search index.protected IndexReadergetIndexReader(boolean includeSystemIndex)Returns an index reader for this search index.intgetMaxExtractLength()intgetMaxFieldLength()longgetMaxHistoryAge()intgetMaxMergeDocs()Returns the current value for maxMergeDocs.longgetMaxVolatileIndexSize()intgetMergeFactor()Returns the current value for the merge factor.intgetMinMergeDocs()Returns the current value for minMergeDocs.NamespaceMappingsgetNamespaceMappings()Returns the namespace mappings for the internal representation.org.apache.tika.parser.ParsergetParser()Returns the parser used for extracting text content from binary properties for full text indexing.StringgetPath()Returns the location of the search index.protected DefaultQueryNodeFactorygetQueryNodeFactory()This method returns the QueryNodeFactory used to parse Queries.RedoLogFactorygetRedoLogFactory()StringgetRedoLogFactoryClass()protected PathgetRelativePath(NodeState nodeState, PropertyState propState)Returns the relative path fromnodeStatetopropState.booleangetRespectDocumentOrder()intgetResultFetchSize()SimilaritygetSimilarity()StringgetSimilarityClass()booleangetSizeEstimate()Get the size estimate setting.protected SharedFieldComparatorSourcegetSortComparatorSource()SpellCheckergetSpellChecker()StringgetSpellCheckerClass()booleangetSupportHighlighting()SynonymProvidergetSynonymProvider()StringgetSynonymProviderClass()StringgetSynonymProviderConfigPath()intgetTermInfosIndexDivisor()AnalyzergetTextAnalyzer()Returns the analyzer in use for indexing.StringgetTextFilterClasses()Deprecated.StringgetTikaConfigPath()Returns the path of the Tika configuration used for text extraction.booleangetUseCompoundFile()Returns the current value for useCompoundFile.intgetVolatileIdleTime()Returns the current value for volatileIdleTime.Iterable<NodeId>getWeaklyReferringNodes(NodeId id)Returns the ids of the nodes that refer to the node withidby weak references.booleanisInitializeHierarchyCache()booleanisUseSimpleFSDirectory()protected voidmergeAggregatedNodeIndexes(NodeState state, Document doc, IndexFormatVersion ifv)Merges the fulltext indexed fields of the aggregated node states intodoc.protected voidretrieveAggregateRoot(Set<NodeId> removedIds, Map<NodeId,NodeState> aggregates)Retrieves the root of the indexing aggregate forremovedIdsand puts it intomap.protected voidretrieveAggregateRoot(NodeState state, Map<NodeId,NodeState> aggregates)Retrieves the root of the indexing aggregate forstateand puts it intoaggregatesmap.ConsistencyCheckrunConsistencyCheck()Runs a consistency check on this search index.voidsetAnalyzer(String analyzerClassName)Sets the default analyzer in use for indexing.voidsetAutoRepair(boolean b)voidsetBufferSize(int size)voidsetCacheSize(int size)voidsetDirectoryManagerClass(String className)Sets name of the directory manager class.voidsetEnableConsistencyCheck(boolean b)Enables or disables the consistency check on startup.voidsetExcerptProviderClass(String className)Sets the class name for theExcerptProviderthat should be used for the rep:excerpt pseudo property in a query.voidsetExtractorBackLogSize(int backLog)The number of extractor jobs that are queued until a new job is executed with the current thread instead of using the thread pool.voidsetExtractorPoolSize(int numThreads)The number of background threads for the extractor pool.voidsetExtractorTimeout(long timeout)The timeout in milliseconds which is granted to the text extraction process until fulltext indexing is deferred to a background thread.voidsetForceConsistencyCheck(boolean b)voidsetForkJavaCommand(String command)Sets the java command used to fork external parser processes.voidsetIndexingConfiguration(String path)Sets the path to the indexing configuration file.voidsetIndexingConfigurationClass(String className)Sets the name of the class that implementsIndexingConfiguration.voidsetInitializeHierarchyCache(boolean initializeHierarchyCache)Whether the hierarchy cache should be initialized immediately on startup.voidsetMaxExtractLength(int length)voidsetMaxFieldLength(int length)voidsetMaxHistoryAge(long maxHistoryAge)Sets a new value for the maximum age in seconds for outdated generations ofIndexInfos.voidsetMaxMergeDocs(int maxMergeDocs)The lucene index writer property: maxMergeDocsvoidsetMaxVolatileIndexSize(long maxVolatileIndexSize)Sets a new maxVolatileIndexSize value.voidsetMergeFactor(int mergeFactor)The lucene index writer property: mergeFactorvoidsetMinMergeDocs(int minMergeDocs)The lucene index writer property: minMergeDocsvoidsetPath(String path)Sets the location of the search index.voidsetRedoLogFactoryClass(String className)Sets the name of the redo log factory class.voidsetRespectDocumentOrder(boolean docOrder)voidsetResultFetchSize(int size)Tells the query handler how many result should be fetched initially when a query is executed.voidsetSimilarityClass(String className)Sets the similarity implementation, which will be used for indexing and searching.voidsetSizeEstimate(boolean b)If enabled, NodeIterator.getSize() may report a larger value than the actual result.voidsetSpellCheckerClass(String className)Sets the name of the class that implementsSpellChecker.voidsetSupportHighlighting(boolean b)If set totrueadditional information is stored in the index to support highlighting using the rep:excerpt pseudo property.voidsetSynonymProviderClass(String className)Sets the name of the class that implementsSynonymProvider.voidsetSynonymProviderConfigPath(String path)Sets the configuration path for the synonym provider.voidsetTermInfosIndexDivisor(int termInfosIndexDivisor)Sets a new value for termInfosIndexDivisor.voidsetTextFilterClasses(String filterClasses)Deprecated.voidsetTikaConfigPath(String tikaConfigPath)Sets the path of the Tika configuration used for text extraction.voidsetUseCompoundFile(boolean b)The lucene index writer property: useCompoundFilevoidsetUseSimpleFSDirectory(boolean useSimpleFSDirectory)voidsetVolatileIdleTime(int volatileIdleTime)Sets the property: volatileIdleTimevoidupdateNodes(Iterator<NodeId> remove, Iterator<NodeState> add)This implementation forwards the call toMultiIndex.update(Collection, Collection)and transforms the two iterators to the required types.-
Methods inherited from class org.apache.jackrabbit.core.query.AbstractQueryHandler
getContext, getIdleTime, getOnWorkspaceInconsistency, getOnWorkspaceInconsistencyHandler, getQueryClass, init, setIdleTime, setOnWorkspaceInconsistency, setQueryClass
-
-
-
-
Field Detail
-
VALID_SYSTEM_INDEX_NODE_TYPE_NAMES
public static final Collection<Name> VALID_SYSTEM_INDEX_NODE_TYPE_NAMES
Valid node type names under /jcr:system. Used to determine if a query needs to be executed also against the /jcr:system tree.
-
DEFAULT_MIN_MERGE_DOCS
public static final int DEFAULT_MIN_MERGE_DOCS
The default value for propertyminMergeDocs.- See Also:
- Constant Field Values
-
DEFAULT_MAX_MERGE_DOCS
public static final int DEFAULT_MAX_MERGE_DOCS
The default value for propertymaxMergeDocs.- See Also:
- Constant Field Values
-
DEFAULT_MERGE_FACTOR
public static final int DEFAULT_MERGE_FACTOR
the default value for propertymergeFactor.- See Also:
- Constant Field Values
-
DEFAULT_MAX_FIELD_LENGTH
public static final int DEFAULT_MAX_FIELD_LENGTH
the default value for propertymaxFieldLength.- See Also:
- Constant Field Values
-
DEFAULT_EXTRACTOR_POOL_SIZE
@Deprecated public static final int DEFAULT_EXTRACTOR_POOL_SIZE
Deprecated.this value is not used anymore. Instead the default value is calculated as follows: 2 * Runtime.getRuntime().availableProcessors().The default value for propertyextractorPoolSize.- See Also:
- Constant Field Values
-
DEFAULT_EXTRACTOR_BACK_LOG
public static final int DEFAULT_EXTRACTOR_BACK_LOG
The default value for propertyextractorBackLog.- See Also:
- Constant Field Values
-
DEFAULT_EXTRACTOR_TIMEOUT
public static final long DEFAULT_EXTRACTOR_TIMEOUT
The default timeout in milliseconds which is granted to the text extraction process until fulltext indexing is deferred to a background thread.- See Also:
- Constant Field Values
-
DEFAULT_TERM_INFOS_INDEX_DIVISOR
public static final int DEFAULT_TERM_INFOS_INDEX_DIVISOR
The default value fortermInfosIndexDivisor.- See Also:
- Constant Field Values
-
PATH_FACTORY
protected static final PathFactory PATH_FACTORY
The path factory.
-
ROOT_PATH
protected static final Path ROOT_PATH
The path of the root node.
-
JCR_SYSTEM_PATH
protected static final Path JCR_SYSTEM_PATH
The path/jcr:system.
-
index
protected MultiIndex index
The actual index
-
-
Method Detail
-
doInit
protected void doInit() throws IOExceptionInitializes thisQueryHandler. This implementation requires that a path parameter is set in the configuration. If this condition is not met, aIOExceptionis thrown.- Specified by:
doInitin classAbstractQueryHandler- Throws:
IOException- if an error occurs while initializing this handler.
-
addNode
public void addNode(NodeState node) throws RepositoryException, IOException
Adds thenodeto the search index.- Parameters:
node- the node to add.- Throws:
RepositoryException- if an error occurs while indexing the node.IOException- if an error occurs while adding the node to the index.
-
deleteNode
public void deleteNode(NodeId id) throws IOException
Removes the node withidfrom the search index.- Parameters:
id- the id of the node to remove from the index.- Throws:
IOException- if an error occurs while removing the node from the index.
-
updateNodes
public void updateNodes(Iterator<NodeId> remove, Iterator<NodeState> add) throws RepositoryException, IOException
This implementation forwards the call toMultiIndex.update(Collection, Collection)and transforms the two iterators to the required types.- Specified by:
updateNodesin interfaceQueryHandler- Overrides:
updateNodesin classAbstractQueryHandler- Parameters:
remove- ids of nodes to remove.add- NodeStates to add. Calls tonext()on this iterator may returnnull, to indicate that a node could not be indexed successfully.- Throws:
RepositoryException- if an error occurs while indexing a node.IOException- if an error occurs while updating the index.
-
createExecutableQuery
public ExecutableQuery createExecutableQuery(SessionContext sessionContext, String statement, String language) throws InvalidQueryException
Creates a new query by specifying the query statement itself and the language in which the query is stated. If the query statement is syntactically invalid, given the language specified, an InvalidQueryException is thrown.languagemust specify a query language string from among those returned by QueryManager.getSupportedQueryLanguages(); if it is not then anInvalidQueryExceptionis thrown.- Parameters:
sessionContext- component context of the current sessionstatement- the query statement.language- the syntax of the query statement.- Returns:
- A
Queryobject. - Throws:
InvalidQueryException- if statement is invalid or language is unsupported.
-
getWeaklyReferringNodes
public Iterable<NodeId> getWeaklyReferringNodes(NodeId id) throws RepositoryException, IOException
Returns the ids of the nodes that refer to the node withidby weak references.- Parameters:
id- the id of the target node.- Returns:
- the ids of the referring nodes.
- Throws:
RepositoryException- if an error occurs.IOException- if an error occurs while reading from the index.
-
getQueryNodeFactory
protected DefaultQueryNodeFactory getQueryNodeFactory()
This method returns the QueryNodeFactory used to parse Queries. This method may be overridden to provide a customized QueryNodeFactory- Returns:
- the query node factory.
-
flush
public void flush() throws RepositoryExceptionWaits until all pending text extraction tasks have been processed and the updated index has been flushed to disk.- Throws:
RepositoryException- if the index update can not be written
-
close
public void close() throws IOExceptionCloses thisQueryHandlerand frees resources attached to this handler.- Specified by:
closein interfaceQueryHandler- Overrides:
closein classAbstractQueryHandler- Throws:
IOException
-
executeQuery
public MultiColumnQueryHits executeQuery(SessionImpl session, AbstractQueryImpl queryImpl, Query query, Path[] orderProps, boolean[] orderSpecs, String[] orderFuncs, long resultFetchHint) throws IOException
Executes the query on the search index.- Parameters:
session- the session that executes the query.queryImpl- the query impl.query- the lucene query.orderProps- name of the properties for sort order.orderSpecs- the order specs for the sort order properties.trueindicates ascending order,falseindicates descending.orderFuncs- functions for the properties for sort order.resultFetchHint- a hint on how many results should be fetched. @return the query hits.- Throws:
IOException- if an error occurs while searching the index.
-
executeQuery
public MultiColumnQueryHits executeQuery(SessionImpl session, MultiColumnQuery query, Ordering[] orderings, long resultFetchHint) throws IOException
Executes the query on the search index.- Parameters:
session- the session that executes the query.query- the query.orderings- the order specs for the sort order.resultFetchHint- a hint on how many results should be fetched.- Returns:
- the query hits.
- Throws:
IOException- if an error occurs while searching the index.
-
createExcerptProvider
public ExcerptProvider createExcerptProvider(Query query) throws IOException
Creates an excerpt provider for the givenquery.- Parameters:
query- the query.- Returns:
- an excerpt provider for the given
query. - Throws:
IOException- if the provider cannot be created.
-
getTextAnalyzer
public Analyzer getTextAnalyzer()
Returns the analyzer in use for indexing.- Returns:
- the analyzer in use for indexing.
-
getTikaConfigPath
public String getTikaConfigPath()
Returns the path of the Tika configuration used for text extraction.- Returns:
- path of the Tika configuration file
-
setTikaConfigPath
public void setTikaConfigPath(String tikaConfigPath)
Sets the path of the Tika configuration used for text extraction. The path can be either a file system or a class resource path. The default setting is the tika-config.xml class resource relative to org.apache.core.query.lucene.- Parameters:
tikaConfigPath- path of the Tika configuration file
-
getForkJavaCommand
public String getForkJavaCommand()
Returns the java command used to fork external parser processes, ornull(the default) for in-process text extraction.- Returns:
- fork java command
-
setForkJavaCommand
public void setForkJavaCommand(String command)
Sets the java command used to fork external parser processes.- Parameters:
command- fork java command, ornullfor in-process extraction
-
getParser
public org.apache.tika.parser.Parser getParser()
Returns the parser used for extracting text content from binary properties for full text indexing.- Returns:
- the configured parser
-
getNamespaceMappings
public NamespaceMappings getNamespaceMappings()
Returns the namespace mappings for the internal representation.- Returns:
- the namespace mappings for the internal representation.
-
getIndexingConfig
public IndexingConfiguration getIndexingConfig()
- Returns:
- the indexing configuration or
nullif there is none.
-
getSynonymProvider
public SynonymProvider getSynonymProvider()
- Returns:
- the synonym provider of this search index. If none is set for this search index the synonym provider of the parent handler is returned if there is any.
-
getSpellChecker
public SpellChecker getSpellChecker()
- Returns:
- the spell checker of this search index. If none is configured
this method returns
null.
-
getSimilarity
public Similarity getSimilarity()
- Returns:
- the similarity, which should be used for indexing and searching.
-
getIndexReader
public IndexReader getIndexReader() throws IOException
Returns an index reader for this search index. The caller of this method is responsible for closing the index reader when he is finished using it.- Returns:
- an index reader for this search index.
- Throws:
IOException- the index reader cannot be obtained.
-
getIndexFormatVersion
public IndexFormatVersion getIndexFormatVersion()
Returns the index format version that this search index is able to support when a query is executed on this index.- Returns:
- the index format version for this search index.
-
getDirectoryManager
public DirectoryManager getDirectoryManager()
- Returns:
- the directory manager for this search index.
-
getRedoLogFactory
public RedoLogFactory getRedoLogFactory()
- Returns:
- the redo log factory for this search index.
-
runConsistencyCheck
public ConsistencyCheck runConsistencyCheck() throws IOException
Runs a consistency check on this search index.- Returns:
- the result of the consistency check.
- Throws:
IOException- if an error occurs while running the check.
-
getIndexReader
protected IndexReader getIndexReader(boolean includeSystemIndex) throws IOException
Returns an index reader for this search index. The caller of this method is responsible for closing the index reader when he is finished using it.- Parameters:
includeSystemIndex- iftruethe index reader will cover the complete workspace. Iffalsethe returned index reader will not contains any nodes under /jcr:system.- Returns:
- an index reader for this search index.
- Throws:
IOException- the index reader cannot be obtained.
-
createSortFields
protected SortField[] createSortFields(Path[] orderProps, boolean[] orderSpecs, String[] orderFuncs)
Creates the SortFields for the order properties.- Parameters:
orderProps- the order properties.orderSpecs- the order specs for the properties.orderFuncs- the functions for the properties.- Returns:
- an array of sort fields
-
createOrderings
protected Ordering[] createOrderings(OrderingImpl[] orderings) throws RepositoryException
Creates internal orderings for the QOM ordering specifications.- Parameters:
orderings- the QOM ordering specifications.- Returns:
- the internal orderings.
- Throws:
RepositoryException- if an error occurs.
-
createDocument
protected Document createDocument(NodeState node, NamespaceMappings nsMappings, IndexFormatVersion indexFormatVersion) throws RepositoryException
Creates a luceneDocumentfor a node state using the namespace mappingsnsMappings.- Parameters:
node- the node state to index.nsMappings- the namespace mappings of the search index.indexFormatVersion- the index format version that should be used to index the passed node state.- Returns:
- a lucene
Documentthat contains all properties ofnode. - Throws:
RepositoryException- if an error occurs while indexing thenode.
-
getIndex
protected MultiIndex getIndex()
Returns the actual index.- Returns:
- the actual index.
-
getSortComparatorSource
protected SharedFieldComparatorSource getSortComparatorSource()
- Returns:
- the field comparator source for this index.
-
createIndexingConfiguration
protected IndexingConfiguration createIndexingConfiguration(NamespaceMappings namespaceMappings)
- Parameters:
namespaceMappings- The namespace mappings- Returns:
- the fulltext indexing configuration or
nullif there is no configuration.
-
createSynonymProvider
protected SynonymProvider createSynonymProvider()
- Returns:
- the configured synonym provider or
nullif none is configured or an error occurs.
-
createDirectoryManager
protected DirectoryManager createDirectoryManager() throws IOException
- Returns:
- an initialized
DirectoryManager. - Throws:
IOException- if the directory manager cannot be instantiated or an exception occurs while initializing the manager.
-
createRedoLogFactory
protected RedoLogFactory createRedoLogFactory() throws IOException
Creates a redo log factory based ongetRedoLogFactoryClass().- Returns:
- the redo log factory.
- Throws:
IOException- if an error occurs while creating the factory.
-
createSynonymProviderConfigResource
protected FileSystemResource createSynonymProviderConfigResource() throws FileSystemException, IOException
Creates a file system resource to the synonym provider configuration.- Returns:
- a file system resource or
nullif no path was configured. - Throws:
FileSystemException- if an exception occurs accessing the file system.IOException- if another exception occurs.
-
createSpellChecker
protected SpellChecker createSpellChecker()
Creates a spell checker for this query handler.- Returns:
- the spell checker or
nullif none is configured or an error occurs.
-
getIndexingConfigurationDOM
protected Element getIndexingConfigurationDOM()
Returns the document element of the indexing configuration ornullif there is no indexing configuration.- Returns:
- the indexing configuration or
nullif there is none.
-
mergeAggregatedNodeIndexes
protected void mergeAggregatedNodeIndexes(NodeState state, Document doc, IndexFormatVersion ifv)
Merges the fulltext indexed fields of the aggregated node states intodoc.- Parameters:
state- the node state on whichdocwas created.doc- the lucene document with index fields fromstate.ifv- the current index format version.
-
getRelativePath
protected Path getRelativePath(NodeState nodeState, PropertyState propState) throws RepositoryException, ItemStateException
Returns the relative path fromnodeStatetopropState.- Parameters:
nodeState- a node state.propState- a property state.- Returns:
- the relative path.
- Throws:
RepositoryException- if an error occurs while resolving paths.ItemStateException- if an error occurs while reading item states.
-
retrieveAggregateRoot
protected void retrieveAggregateRoot(NodeState state, Map<NodeId,NodeState> aggregates)
Retrieves the root of the indexing aggregate forstateand puts it intoaggregatesmap.- Parameters:
state- the node state for which we want to retrieve the aggregate root.aggregates- aggregate roots are collected in this map.
-
retrieveAggregateRoot
protected void retrieveAggregateRoot(Set<NodeId> removedIds, Map<NodeId,NodeState> aggregates)
Retrieves the root of the indexing aggregate forremovedIdsand puts it intomap.- Parameters:
removedIds- the ids of removed nodes.aggregates- aggregate roots are collected in this map
-
setAnalyzer
public void setAnalyzer(String analyzerClassName)
Sets the default analyzer in use for indexing. The given analyzer class name must satisfy the following conditions:- the class must exist in the class path
- the class must have a public default constructor, or
a constructor that takes a Lucene
Versionargument - the class must be a Lucene Analyzer
If the above conditions are met, then a new instance of the class is set as the analyzer. Otherwise a warning is logged and the current analyzer is not changed.
This property setter method is normally invoked by the Jackrabbit configuration mechanism if the "analyzer" parameter is set in the search configuration.
- Parameters:
analyzerClassName- the analyzer class name
-
getAnalyzer
public String getAnalyzer()
Returns the class name of the default analyzer that is currently in use.- Returns:
- class name of analyzer in use.
-
setPath
public void setPath(String path)
Sets the location of the search index.- Parameters:
path- the location of the search index.
-
getPath
public String getPath()
Returns the location of the search index. Returnsnullif not set.- Returns:
- the location of the search index.
-
setUseCompoundFile
public void setUseCompoundFile(boolean b)
The lucene index writer property: useCompoundFile
-
getUseCompoundFile
public boolean getUseCompoundFile()
Returns the current value for useCompoundFile.- Returns:
- the current value for useCompoundFile.
-
setMinMergeDocs
public void setMinMergeDocs(int minMergeDocs)
The lucene index writer property: minMergeDocs
-
getMinMergeDocs
public int getMinMergeDocs()
Returns the current value for minMergeDocs.- Returns:
- the current value for minMergeDocs.
-
setVolatileIdleTime
public void setVolatileIdleTime(int volatileIdleTime)
Sets the property: volatileIdleTime- Parameters:
volatileIdleTime- idle time in seconds
-
getVolatileIdleTime
public int getVolatileIdleTime()
Returns the current value for volatileIdleTime.- Returns:
- the current value for volatileIdleTime.
-
setMaxMergeDocs
public void setMaxMergeDocs(int maxMergeDocs)
The lucene index writer property: maxMergeDocs
-
getMaxMergeDocs
public int getMaxMergeDocs()
Returns the current value for maxMergeDocs.- Returns:
- the current value for maxMergeDocs.
-
setMergeFactor
public void setMergeFactor(int mergeFactor)
The lucene index writer property: mergeFactor
-
getMergeFactor
public int getMergeFactor()
Returns the current value for the merge factor.- Returns:
- the current value for the merge factor.
-
setBufferSize
public void setBufferSize(int size)
- See Also:
VolatileIndex.setBufferSize(int)
-
getBufferSize
public int getBufferSize()
Returns the current value for the buffer size.- Returns:
- the current value for the buffer size.
-
setRespectDocumentOrder
public void setRespectDocumentOrder(boolean docOrder)
-
getRespectDocumentOrder
public boolean getRespectDocumentOrder()
-
setForceConsistencyCheck
public void setForceConsistencyCheck(boolean b)
-
getForceConsistencyCheck
public boolean getForceConsistencyCheck()
-
setAutoRepair
public void setAutoRepair(boolean b)
-
getAutoRepair
public boolean getAutoRepair()
-
setCacheSize
public void setCacheSize(int size)
-
getCacheSize
public int getCacheSize()
-
setMaxFieldLength
public void setMaxFieldLength(int length)
-
getMaxFieldLength
public int getMaxFieldLength()
-
setMaxExtractLength
public void setMaxExtractLength(int length)
-
getMaxExtractLength
public int getMaxExtractLength()
-
setTextFilterClasses
@Deprecated public void setTextFilterClasses(String filterClasses)
Deprecated.Sets the list of text extractors (and text filters) to use for extracting text content from binary properties. The list must be comma (or whitespace) separated, and contain fully qualified class names of theTextExtractor(andorg.apache.jackrabbit.core.query.TextFilter) classes to be used. The configured classes must all have a public default constructor.- Parameters:
filterClasses- comma separated list of class names
-
getTextFilterClasses
@Deprecated public String getTextFilterClasses()
Deprecated.Returns the fully qualified class names of the text filter instances currently in use. The names are comma separated.- Returns:
- class names of the text filters in use.
-
setResultFetchSize
public void setResultFetchSize(int size)
Tells the query handler how many result should be fetched initially when a query is executed.- Parameters:
size- the number of results to fetch initially.
-
getResultFetchSize
public int getResultFetchSize()
- Returns:
- the number of results the query handler will fetch initially when a query is executed.
-
setExtractorPoolSize
public void setExtractorPoolSize(int numThreads)
The number of background threads for the extractor pool.- Parameters:
numThreads- the number of threads.
-
getExtractorPoolSize
public int getExtractorPoolSize()
- Returns:
- the size of the thread pool which is used to run the text extractors when binary content is indexed.
-
setExtractorBackLogSize
public void setExtractorBackLogSize(int backLog)
The number of extractor jobs that are queued until a new job is executed with the current thread instead of using the thread pool.- Parameters:
backLog- size of the extractor job queue.
-
getExtractorBackLogSize
public int getExtractorBackLogSize()
- Returns:
- the size of the extractor queue back log.
-
setExtractorTimeout
public void setExtractorTimeout(long timeout)
The timeout in milliseconds which is granted to the text extraction process until fulltext indexing is deferred to a background thread.- Parameters:
timeout- the timeout in milliseconds.
-
getExtractorTimeout
public long getExtractorTimeout()
- Returns:
- the extractor timeout in milliseconds.
-
setSizeEstimate
public void setSizeEstimate(boolean b)
If enabled, NodeIterator.getSize() may report a larger value than the actual result. This value may shrink when the query result encounters non-existing nodes or the session does not have access to a node. This might be a security problem.- Parameters:
b-trueto enable
-
getSizeEstimate
public boolean getSizeEstimate()
Get the size estimate setting.- Returns:
- the setting
-
setSupportHighlighting
public void setSupportHighlighting(boolean b)
If set totrueadditional information is stored in the index to support highlighting using the rep:excerpt pseudo property.- Parameters:
b-trueto enable highlighting support.
-
getSupportHighlighting
public boolean getSupportHighlighting()
- Returns:
trueif highlighting support is enabled.
-
setExcerptProviderClass
public void setExcerptProviderClass(String className)
Sets the class name for theExcerptProviderthat should be used for the rep:excerpt pseudo property in a query.- Parameters:
className- the name of a class that implementsExcerptProvider.
-
getExcerptProviderClass
public String getExcerptProviderClass()
- Returns:
- the class name of the excerpt provider implementation.
-
setIndexingConfiguration
public void setIndexingConfiguration(String path)
Sets the path to the indexing configuration file.- Parameters:
path- the path to the configuration file.
-
getIndexingConfiguration
public String getIndexingConfiguration()
- Returns:
- the path to the indexing configuration file.
-
setIndexingConfigurationClass
public void setIndexingConfigurationClass(String className)
Sets the name of the class that implementsIndexingConfiguration. The default value isorg.apache.jackrabbit.core.query.lucene.IndexingConfigurationImpl.- Parameters:
className- the name of the class that implementsIndexingConfiguration.
-
getIndexingConfigurationClass
public String getIndexingConfigurationClass()
- Returns:
- the class name of the indexing configuration implementation.
-
setSynonymProviderClass
public void setSynonymProviderClass(String className)
Sets the name of the class that implementsSynonymProvider. The default value isnull(none set).- Parameters:
className- name of the class that implementsSynonymProvider.
-
getSynonymProviderClass
public String getSynonymProviderClass()
- Returns:
- the class name of the synonym provider implementation or
nullif none is set.
-
setSpellCheckerClass
public void setSpellCheckerClass(String className)
Sets the name of the class that implementsSpellChecker. The default value isnull(none set).- Parameters:
className- name of the class that implementsSpellChecker.
-
getSpellCheckerClass
public String getSpellCheckerClass()
- Returns:
- the class name of the spell checker implementation or
nullif none is set.
-
setEnableConsistencyCheck
public void setEnableConsistencyCheck(boolean b)
Enables or disables the consistency check on startup. Consistency checks are disabled per default.- Parameters:
b-trueenables consistency checks.- See Also:
setForceConsistencyCheck(boolean)
-
getEnableConsistencyCheck
public boolean getEnableConsistencyCheck()
- Returns:
trueif consistency checks are enabled.
-
setSynonymProviderConfigPath
public void setSynonymProviderConfigPath(String path)
Sets the configuration path for the synonym provider.- Parameters:
path- the configuration path for the synonym provider.
-
getSynonymProviderConfigPath
public String getSynonymProviderConfigPath()
- Returns:
- the configuration path for the synonym provider. If none is set
this method returns
null.
-
setSimilarityClass
public void setSimilarityClass(String className)
Sets the similarity implementation, which will be used for indexing and searching. The implementation must extendSimilarity.- Parameters:
className- aSimilarityimplementation.
-
getSimilarityClass
public String getSimilarityClass()
- Returns:
- the name of the similarity class.
-
setMaxVolatileIndexSize
public void setMaxVolatileIndexSize(long maxVolatileIndexSize)
Sets a new maxVolatileIndexSize value.- Parameters:
maxVolatileIndexSize- the new value.
-
getMaxVolatileIndexSize
public long getMaxVolatileIndexSize()
- Returns:
- the maxVolatileIndexSize in bytes.
-
getDirectoryManagerClass
public String getDirectoryManagerClass()
- Returns:
- the name of the directory manager class.
-
setDirectoryManagerClass
public void setDirectoryManagerClass(String className)
Sets name of the directory manager class. The class must implementDirectoryManager.- Parameters:
className- the name of the class that implements directory manager.
-
setUseSimpleFSDirectory
public void setUseSimpleFSDirectory(boolean useSimpleFSDirectory)
- Parameters:
useSimpleFSDirectory- whether to useSimpleFSDirectoryor automatically pick an implementation based on the current platform.
-
isUseSimpleFSDirectory
public boolean isUseSimpleFSDirectory()
- Returns:
trueif theDirectoryManagershould use theSimpleFSDirectory.
-
getTermInfosIndexDivisor
public int getTermInfosIndexDivisor()
- Returns:
- the current value for termInfosIndexDivisor.
-
setTermInfosIndexDivisor
public void setTermInfosIndexDivisor(int termInfosIndexDivisor)
Sets a new value for termInfosIndexDivisor.- Parameters:
termInfosIndexDivisor- the new value.
-
isInitializeHierarchyCache
public boolean isInitializeHierarchyCache()
- Returns:
trueif the hierarchy cache should be initialized immediately on startup.
-
setInitializeHierarchyCache
public void setInitializeHierarchyCache(boolean initializeHierarchyCache)
Whether the hierarchy cache should be initialized immediately on startup.- Parameters:
initializeHierarchyCache-trueif the cache should be initialized immediately.
-
getMaxHistoryAge
public long getMaxHistoryAge()
- Returns:
- the maximum age in seconds for outdated generations of
IndexInfos.
-
setMaxHistoryAge
public void setMaxHistoryAge(long maxHistoryAge)
Sets a new value for the maximum age in seconds for outdated generations ofIndexInfos.- Parameters:
maxHistoryAge- age in seconds.
-
getRedoLogFactoryClass
public String getRedoLogFactoryClass()
- Returns:
- the name of the redo log factory class.
-
setRedoLogFactoryClass
public void setRedoLogFactoryClass(String className)
Sets the name of the redo log factory class. Must implementRedoLogFactory.- Parameters:
className- the name of the redo log factory class.
-
checkOpen
protected void checkOpen() throws IOExceptionChecks if thisSearchIndexis open, otherwise throws anIOException.- Throws:
IOException- if thisSearchIndexhad been closed.
-
-