org.alfresco.repo.search.impl.lucene
Class AbstractLuceneIndexerAndSearcherFactory

java.lang.Object
  extended by org.alfresco.repo.search.impl.lucene.AbstractIndexerAndSearcher
      extended by org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerAndSearcherFactory
All Implemented Interfaces:
javax.transaction.xa.XAResource, LuceneConfig, LuceneIndexerAndSearcher, IndexerAndSearcher, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
ADMLuceneIndexerAndSearcherFactory, AVMLuceneIndexerAndSearcherFactory

public abstract class AbstractLuceneIndexerAndSearcherFactory
extends AbstractIndexerAndSearcher
implements LuceneIndexerAndSearcher, javax.transaction.xa.XAResource, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean

This class is resource manager LuceneIndexers and LuceneSearchers. It supports two phase commit inside XA transactions and outside transactions it provides thread local transaction support. TODO: Provide pluggable support for a transaction manager TODO: Integrate with Spring transactions


Nested Class Summary
static class AbstractLuceneIndexerAndSearcherFactory.LuceneIndexBackupComponent
          This component is able to safely perform backups of the Lucene indexes while the server is running.
static class AbstractLuceneIndexerAndSearcherFactory.LuceneIndexBackupJob
          Job that lock uses the AbstractLuceneIndexerAndSearcherFactory.LuceneIndexBackupComponent to perform safe backups of the Lucene indexes.
 
Nested classes/interfaces inherited from interface org.alfresco.repo.search.impl.lucene.LuceneIndexerAndSearcher
LuceneIndexerAndSearcher.ReadOnlyWork
 
Field Summary
protected  org.alfresco.repo.tenant.TenantService tenantService
           
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
AbstractLuceneIndexerAndSearcherFactory()
          Private constructor for the singleton TODO: FIt in with IOC
 
Method Summary
 void commit()
          Commit the transaction
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
           
protected abstract  LuceneIndexer createIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String deltaId)
          Encapsulate creating an indexer
static void deleteDirectory(java.io.File directory)
           
 void destroy()
           
 java.lang.Object doReadOnly(LuceneIndexerAndSearcher.ReadOnlyWork lockWork)
           
 void end(javax.transaction.xa.Xid xid, int flag)
           
 void flush()
          Do any indexing that may be pending on behalf of the current transaction.
 void forget(javax.transaction.xa.Xid xid)
           
protected abstract  java.util.List getAllStores()
           
 org.springframework.context.ConfigurableApplicationContext getApplicationContext()
          Gets the application context through which events can be broadcast
 NodeBulkLoader getBulkLoader()
          Get preloader - may be null if preloading is not supported
 long getCommitLockTimeout()
          Get the commit lock timout.
 org.alfresco.repo.search.MLAnalysisMode getDefaultMLIndexAnalysisMode()
          The default mode for analysing ML text during index.
 org.alfresco.repo.search.MLAnalysisMode getDefaultMLSearchAnalysisMode()
          The default mode for analysis of ML text during search.
 boolean getFairLocking()
          Should we use a 'fair' locking policy, giving queue-like access behaviour to the indexes and avoiding starvation? Default is false since fair locking appears to cause deadlock on old JVMs.
 LuceneIndexer getIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef)
          Get an indexer for the store to use in the current transaction for this thread of control.
 int getIndexerBatchSize()
          The batch size in which to group flushes of the index.
 int getIndexerMaxFieldLength()
          Get the max number of tokens in the field
 java.lang.String getIndexRootLocation()
          The path to the index location
 java.lang.String getLockDirectory()
          Get the directory where any lock files are written (by default there are none)
 int getMaxDocIdCacheSize()
          How many document ids to cache (-ve => unbounded)
 int getMaxDocsForInMemoryIndex()
          Max docs to allow for in memory indexes (does no apply to merges)
 int getMaxDocsForInMemoryMerge()
          Max doc number that will merged in memory (and not on disk)
 int getMaxDocumentCacheSize()
          How many documents to cache (-ve => unbounded)
 int getMaxIsCategoryCacheSize()
          How many categories to cache (-ve => unbounded)
 int getMaxLinkAspectCacheSize()
          How many link aspects to cache (-ve => unbounded)
 int getMaxParentCacheSize()
          How many parents to cache (-ve => unbounded)
 int getMaxPathCacheSize()
          How many paths to cache (-ve => unbounded)
 double getMaxRamInMbForInMemoryIndex()
          Max Ram to allow for in memory indexes (does not apply to merges)
 double getMaxRamInMbForInMemoryMerge()
          Ram based limit for in memory merges
 long getMaxTransformationTime()
          Get the max time for an atomic transform
 int getMaxTypeCacheSize()
          How many types to cache (-ve => unbounded)
 int getMergerMaxBufferedDocs()
          Lucene merger config
 int getMergerMaxMergeDocs()
          Lucene merger config
 int getMergerMergeFactor()
          Lucene merger config
 double getMergerRamBufferSizeMb()
          Ram based limit for in memory portion of merger index.
 int getMergerTargetIndexCount()
          Target index count.
 int getMergerTargetOverlayCount()
          Target overlays (will apply deletions and create indexes if over this limit)
 int getMergerTargetOverlaysBlockingFactor()
          The factor by which the target overlay count is multiplied to determine the allowable number of overlays before blocking.
protected abstract  org.alfresco.service.cmr.search.SearchService getNodeSearcher()
          Get node-based searcher (for "selectNodes / selectProperties")
 boolean getPostSortDateTime()
          If we are using the DateAnalyser then lucene sort is only to the date, as that is all that is in the index.
protected  LuceneQueryLanguageSPI getQueryLanguage(java.lang.String name)
           
 int getQueryMaxClauses()
          The maximum numbr of sub-queries the can be generated out of wild card expansion etc
 QueryRegisterComponent getQueryRegister()
          Get the query register.
 LuceneSearcher getSearcher(org.alfresco.service.cmr.repository.StoreRef storeRef, boolean searchDelta)
          Encapsulate creating a searcher over the main index
protected abstract  LuceneSearcher getSearcher(org.alfresco.service.cmr.repository.StoreRef storeRef, LuceneIndexer indexer)
          Get a searcher over the index and the current delta
 int getTermIndexInterval()
          Lucene term index interval
 java.util.concurrent.ThreadPoolExecutor getThreadPoolExecutor()
          Get the thread pool for index merging etc
 int getTransactionTimeout()
           
 boolean getUseNioMemoryMapping()
          Use the nio memory mapping (work arounf for bugs with some JVMs)
 long getWriteLockTimeout()
          Get the write lock timeout
 int getWriterMaxBufferedDocs()
          Lucene writer config
 int getWriterMaxMergeDocs()
          Lucene writer config
 int getWriterMergeFactor()
          Lucene writer config
 double getWriterRamBufferSizeMb()
          Ram based limit for in memory portion of writer index.
 boolean isCacheEnabled()
          Is caching enabled for each index fragment?
 boolean isContentIndexingEnabled()
           
 boolean isSameRM(javax.transaction.xa.XAResource xar)
           
static void main(java.lang.String[] args)
           
 int prepare()
          Prepare the transaction TODO: Store prepare results
 int prepare(javax.transaction.xa.Xid xid)
           
 javax.transaction.xa.Xid[] recover(int arg0)
           
 void rollback()
          Roll back the transaction
 void rollback(javax.transaction.xa.Xid xid)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setBulkLoader(NodeBulkLoader bulkLoader)
           
 void setCacheEnabled(boolean cacheEnabled)
           
 void setCommitLockTimeout(long timeout)
          Set the lucene commit lock timeout (no longer used with lucene 2.1)
 void setContentIndexingEnabled(boolean contentIndexingEnabled)
          Enable/Disable the indexing of content Content is not indexed and FTS disabled When disabled, documents are marked as requiring FTS indexing.
 void setDefaultMLIndexAnalysisMode(org.alfresco.repo.search.MLAnalysisMode mode)
          Set the ML analysis mode at index time.
 void setDefaultMLSearchAnalysisMode(org.alfresco.repo.search.MLAnalysisMode mode)
          Set the ML analysis mode at search time
 void setFairLocking(boolean fairLocking)
           
 void setIndexerBatchSize(int indexerBatchSize)
          Set the batch six to use for background indexing
 void setIndexerMaxFieldLength(int indexerMaxFieldLength)
          Set the max field length.
 void setIndexRootLocation(java.lang.String indexRootLocation)
          Set the directory that contains the indexes
 void setLockDirectory(java.lang.String lockDirectory)
          Set the lock dir - just to make sure - this should no longer be used.
 void setLockPollInterval(long time)
          Set the lock poll interval in ms
 void setMaxAtomicTransformationTime(long maxAtomicTransformationTime)
          Set the maximum average transformation time allowed to a transformer in order to have the transformation performed in the current transaction.
 void setMaxDocIdCacheSize(int maxDocIdCacheSize)
           
 void setMaxDocsForInMemoryIndex(int maxDocsForInMemoryIndex)
           
 void setMaxDocsForInMemoryMerge(int maxDocsForInMemoryMerge)
           
 void setMaxDocumentCacheSize(int maxDocumentCacheSize)
           
 void setMaxIsCategoryCacheSize(int maxIsCategoryCacheSize)
           
 void setMaxLinkAspectCacheSize(int maxLinkAspectCacheSize)
           
 void setMaxParentCacheSize(int maxParentCacheSize)
           
 void setMaxPathCacheSize(int maxPathCacheSize)
           
 void setMaxRamInMbForInMemoryIndex(double maxRamInMbForInMemoryIndex)
           
 void setMaxRamInMbForInMemoryMerge(double maxRamInMbForInMemoryMerge)
           
 void setMaxTypeCacheSize(int maxTypeCacheSize)
           
 void setMergerMaxBufferedDocs(int mergerMaxBufferedDocs)
           
 void setMergerMaxMergeDocs(int mergerMaxMergeDocs)
           
 void setMergerMergeFactor(int mergerMergeFactor)
           
 void setMergerRamBufferSizeMb(double mergerRamBufferSizeMb)
           
 void setMergerTargetIndexCount(int mergerTargetIndexCount)
           
 void setMergerTargetOverlayCount(int mergerTargetOverlayCount)
           
 void setMergerTargetOverlaysBlockingFactor(int mergerTargetOverlaysBlockingFactor)
           
 void setPostSortDateTime(boolean postSortDateTime)
           
 void setQueryMaxClauses(int queryMaxClauses)
          Set the max number of queries in a llucen boolean query
 void setQueryRegister(QueryRegisterComponent queryRegister)
          Set the query register
 void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
          Set the tenant service
 void setTermIndexInterval(int termIndexInterval)
           
 void setThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor)
           
 boolean setTransactionTimeout(int timeout)
           
 void setUseNioMemoryMapping(boolean useNioMemoryMapping)
           
 void setWriteLockTimeout(long timeout)
          Set the lucene write lock timeout
 void setWriterMaxBufferedDocs(int writerMaxBufferedDocs)
           
 void setWriterMaxMergeDocs(int writerMaxMergeDocs)
           
 void setWriterMergeFactor(int writerMergeFactor)
           
 void setWriterRamBufferSizeMb(double writerRamBufferSizeMb)
           
 void start(javax.transaction.xa.Xid xid, int flag)
           
 
Methods inherited from class org.alfresco.repo.search.impl.lucene.AbstractIndexerAndSearcher
getQueryLanguages, registerQueryLanguage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.repo.search.IndexerAndSearcher
getQueryLanguages, registerQueryLanguage
 

Field Detail

tenantService

protected org.alfresco.repo.tenant.TenantService tenantService
Constructor Detail

AbstractLuceneIndexerAndSearcherFactory

public AbstractLuceneIndexerAndSearcherFactory()
Private constructor for the singleton TODO: FIt in with IOC

Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getApplicationContext

public org.springframework.context.ConfigurableApplicationContext getApplicationContext()
Description copied from interface: LuceneConfig
Gets the application context through which events can be broadcast

Specified by:
getApplicationContext in interface LuceneConfig
Returns:

setIndexRootLocation

public void setIndexRootLocation(java.lang.String indexRootLocation)
Set the directory that contains the indexes

Parameters:
indexRootLocation -

setTenantService

public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
Set the tenant service

Parameters:
tenantService -

setQueryRegister

public void setQueryRegister(QueryRegisterComponent queryRegister)
Set the query register

Parameters:
queryRegister -

getQueryRegister

public QueryRegisterComponent getQueryRegister()
Get the query register.

Returns:
- the query register.

setMaxAtomicTransformationTime

public void setMaxAtomicTransformationTime(long maxAtomicTransformationTime)
Set the maximum average transformation time allowed to a transformer in order to have the transformation performed in the current transaction. The default is 20ms.

Specified by:
setMaxAtomicTransformationTime in interface LuceneConfig
Parameters:
maxAtomicTransformationTime - the maximum average time that a text transformation may take in order to be performed atomically.

getMaxTransformationTime

public long getMaxTransformationTime()
Get the max time for an atomic transform

Specified by:
getMaxTransformationTime in interface LuceneConfig
Returns:
- milliseconds as a long

getBulkLoader

public NodeBulkLoader getBulkLoader()
Description copied from interface: LuceneConfig
Get preloader - may be null if preloading is not supported

Specified by:
getBulkLoader in interface LuceneConfig

setBulkLoader

public void setBulkLoader(NodeBulkLoader bulkLoader)

getIndexer

public LuceneIndexer getIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef)
                         throws IndexerException
Get an indexer for the store to use in the current transaction for this thread of control.

Specified by:
getIndexer in interface IndexerAndSearcher
Parameters:
storeRef - - the id of the store
Returns:
Throws:
IndexerException

createIndexer

protected abstract LuceneIndexer createIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                               java.lang.String deltaId)
Encapsulate creating an indexer

Parameters:
storeRef -
deltaId -
Returns:
- the indexer made by the concrete implemntation

getSearcher

public LuceneSearcher getSearcher(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                  boolean searchDelta)
                           throws SearcherException
Encapsulate creating a searcher over the main index

Specified by:
getSearcher in interface IndexerAndSearcher
searchDelta - - serach the in progress transaction as well as the main index (this is ignored for searches that do full text)
Returns:
Throws:
SearcherException

getNodeSearcher

protected abstract org.alfresco.service.cmr.search.SearchService getNodeSearcher()
                                                                          throws SearcherException
Get node-based searcher (for "selectNodes / selectProperties")

Throws:
SearcherException

getSearcher

protected abstract LuceneSearcher getSearcher(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                              LuceneIndexer indexer)
                                       throws SearcherException
Get a searcher over the index and the current delta

Parameters:
storeRef -
deltaId -
Returns:
- the searcher made by the concrete implementation.
Throws:
SearcherException

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Specified by:
commit in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flag)
         throws javax.transaction.xa.XAException
Specified by:
end in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
forget in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xar)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
prepare in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int arg0)
                                   throws javax.transaction.xa.XAException
Specified by:
recover in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Specified by:
rollback in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int timeout)
                              throws javax.transaction.xa.XAException
Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flag)
           throws javax.transaction.xa.XAException
Specified by:
start in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

commit

public void commit()
            throws IndexerException
Commit the transaction

Specified by:
commit in interface LuceneIndexerAndSearcher
Throws:
IndexerException

prepare

public int prepare()
            throws IndexerException
Prepare the transaction TODO: Store prepare results

Specified by:
prepare in interface LuceneIndexerAndSearcher
Returns:
- the tx code
Throws:
IndexerException

rollback

public void rollback()
Roll back the transaction

Specified by:
rollback in interface LuceneIndexerAndSearcher

flush

public void flush()
Description copied from interface: IndexerAndSearcher
Do any indexing that may be pending on behalf of the current transaction.

Specified by:
flush in interface IndexerAndSearcher

getIndexRootLocation

public java.lang.String getIndexRootLocation()
Description copied from interface: LuceneConfig
The path to the index location

Specified by:
getIndexRootLocation in interface LuceneConfig
Returns:

getIndexerBatchSize

public int getIndexerBatchSize()
Description copied from interface: LuceneConfig
The batch size in which to group flushes of the index.

Specified by:
getIndexerBatchSize in interface LuceneConfig
Returns:

setIndexerBatchSize

public void setIndexerBatchSize(int indexerBatchSize)
Set the batch six to use for background indexing

Specified by:
setIndexerBatchSize in interface LuceneConfig
Parameters:
indexerBatchSize -

getLockDirectory

public java.lang.String getLockDirectory()
Get the directory where any lock files are written (by default there are none)

Returns:
- the path to the directory

setLockDirectory

public void setLockDirectory(java.lang.String lockDirectory)
Description copied from interface: LuceneConfig
Set the lock dir - just to make sure - this should no longer be used.

Specified by:
setLockDirectory in interface LuceneConfig

getQueryMaxClauses

public int getQueryMaxClauses()
Description copied from interface: LuceneConfig
The maximum numbr of sub-queries the can be generated out of wild card expansion etc

Specified by:
getQueryMaxClauses in interface LuceneConfig
Returns:

setQueryMaxClauses

public void setQueryMaxClauses(int queryMaxClauses)
Set the max number of queries in a llucen boolean query

Specified by:
setQueryMaxClauses in interface LuceneConfig
Parameters:
queryMaxClauses -

setWriteLockTimeout

public void setWriteLockTimeout(long timeout)
Set the lucene write lock timeout

Specified by:
setWriteLockTimeout in interface LuceneConfig
Parameters:
timeout -

setCommitLockTimeout

public void setCommitLockTimeout(long timeout)
Set the lucene commit lock timeout (no longer used with lucene 2.1)

Specified by:
setCommitLockTimeout in interface LuceneConfig
Parameters:
timeout -

getCommitLockTimeout

public long getCommitLockTimeout()
Get the commit lock timout.

Specified by:
getCommitLockTimeout in interface LuceneConfig
Returns:
- the timeout

getWriteLockTimeout

public long getWriteLockTimeout()
Get the write lock timeout

Specified by:
getWriteLockTimeout in interface LuceneConfig
Returns:
- the timeout in ms

setLockPollInterval

public void setLockPollInterval(long time)
Set the lock poll interval in ms

Specified by:
setLockPollInterval in interface LuceneConfig
Parameters:
time -

getIndexerMaxFieldLength

public int getIndexerMaxFieldLength()
Get the max number of tokens in the field

Specified by:
getIndexerMaxFieldLength in interface LuceneConfig
Returns:
- the max tokens considered.

setIndexerMaxFieldLength

public void setIndexerMaxFieldLength(int indexerMaxFieldLength)
Set the max field length.

Specified by:
setIndexerMaxFieldLength in interface LuceneConfig
Parameters:
indexerMaxFieldLength -

getThreadPoolExecutor

public java.util.concurrent.ThreadPoolExecutor getThreadPoolExecutor()
Description copied from interface: LuceneConfig
Get the thread pool for index merging etc

Specified by:
getThreadPoolExecutor in interface LuceneConfig
Returns:

setThreadPoolExecutor

public void setThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor)

getDefaultMLIndexAnalysisMode

public org.alfresco.repo.search.MLAnalysisMode getDefaultMLIndexAnalysisMode()
Description copied from interface: LuceneConfig
The default mode for analysing ML text during index.

Specified by:
getDefaultMLIndexAnalysisMode in interface LuceneConfig
Returns:

setDefaultMLIndexAnalysisMode

public void setDefaultMLIndexAnalysisMode(org.alfresco.repo.search.MLAnalysisMode mode)
Set the ML analysis mode at index time.

Specified by:
setDefaultMLIndexAnalysisMode in interface LuceneConfig
Parameters:
mode -

getDefaultMLSearchAnalysisMode

public org.alfresco.repo.search.MLAnalysisMode getDefaultMLSearchAnalysisMode()
Description copied from interface: LuceneConfig
The default mode for analysis of ML text during search.

Specified by:
getDefaultMLSearchAnalysisMode in interface LuceneConfig
Returns:

setDefaultMLSearchAnalysisMode

public void setDefaultMLSearchAnalysisMode(org.alfresco.repo.search.MLAnalysisMode mode)
Set the ML analysis mode at search time

Specified by:
setDefaultMLSearchAnalysisMode in interface LuceneConfig
Parameters:
mode -

getMaxDocIdCacheSize

public int getMaxDocIdCacheSize()
Description copied from interface: LuceneConfig
How many document ids to cache (-ve => unbounded)

Specified by:
getMaxDocIdCacheSize in interface LuceneConfig
Returns:

setMaxDocIdCacheSize

public void setMaxDocIdCacheSize(int maxDocIdCacheSize)
Specified by:
setMaxDocIdCacheSize in interface LuceneConfig

getMaxDocsForInMemoryMerge

public int getMaxDocsForInMemoryMerge()
Description copied from interface: LuceneConfig
Max doc number that will merged in memory (and not on disk)

Specified by:
getMaxDocsForInMemoryMerge in interface LuceneConfig
Returns:

setMaxDocsForInMemoryMerge

public void setMaxDocsForInMemoryMerge(int maxDocsForInMemoryMerge)
Specified by:
setMaxDocsForInMemoryMerge in interface LuceneConfig

getMaxDocumentCacheSize

public int getMaxDocumentCacheSize()
Description copied from interface: LuceneConfig
How many documents to cache (-ve => unbounded)

Specified by:
getMaxDocumentCacheSize in interface LuceneConfig
Returns:

setMaxDocumentCacheSize

public void setMaxDocumentCacheSize(int maxDocumentCacheSize)
Specified by:
setMaxDocumentCacheSize in interface LuceneConfig

getMaxIsCategoryCacheSize

public int getMaxIsCategoryCacheSize()
Description copied from interface: LuceneConfig
How many categories to cache (-ve => unbounded)

Specified by:
getMaxIsCategoryCacheSize in interface LuceneConfig
Returns:

setMaxIsCategoryCacheSize

public void setMaxIsCategoryCacheSize(int maxIsCategoryCacheSize)
Specified by:
setMaxIsCategoryCacheSize in interface LuceneConfig

getMaxLinkAspectCacheSize

public int getMaxLinkAspectCacheSize()
Description copied from interface: LuceneConfig
How many link aspects to cache (-ve => unbounded)

Specified by:
getMaxLinkAspectCacheSize in interface LuceneConfig
Returns:

setMaxLinkAspectCacheSize

public void setMaxLinkAspectCacheSize(int maxLinkAspectCacheSize)
Specified by:
setMaxLinkAspectCacheSize in interface LuceneConfig

getMaxParentCacheSize

public int getMaxParentCacheSize()
Description copied from interface: LuceneConfig
How many parents to cache (-ve => unbounded)

Specified by:
getMaxParentCacheSize in interface LuceneConfig
Returns:

setMaxParentCacheSize

public void setMaxParentCacheSize(int maxParentCacheSize)
Specified by:
setMaxParentCacheSize in interface LuceneConfig

getMaxPathCacheSize

public int getMaxPathCacheSize()
Description copied from interface: LuceneConfig
How many paths to cache (-ve => unbounded)

Specified by:
getMaxPathCacheSize in interface LuceneConfig
Returns:

setMaxPathCacheSize

public void setMaxPathCacheSize(int maxPathCacheSize)
Specified by:
setMaxPathCacheSize in interface LuceneConfig

getMaxTypeCacheSize

public int getMaxTypeCacheSize()
Description copied from interface: LuceneConfig
How many types to cache (-ve => unbounded)

Specified by:
getMaxTypeCacheSize in interface LuceneConfig
Returns:

setMaxTypeCacheSize

public void setMaxTypeCacheSize(int maxTypeCacheSize)
Specified by:
setMaxTypeCacheSize in interface LuceneConfig

getMergerMaxMergeDocs

public int getMergerMaxMergeDocs()
Description copied from interface: LuceneConfig
Lucene merger config

Specified by:
getMergerMaxMergeDocs in interface LuceneConfig
Returns:

setMergerMaxMergeDocs

public void setMergerMaxMergeDocs(int mergerMaxMergeDocs)
Specified by:
setMergerMaxMergeDocs in interface LuceneConfig

getMergerMergeFactor

public int getMergerMergeFactor()
Description copied from interface: LuceneConfig
Lucene merger config

Specified by:
getMergerMergeFactor in interface LuceneConfig
Returns:

setMergerMergeFactor

public void setMergerMergeFactor(int mergerMergeFactor)
Specified by:
setMergerMergeFactor in interface LuceneConfig

getMergerMaxBufferedDocs

public int getMergerMaxBufferedDocs()
Description copied from interface: LuceneConfig
Lucene merger config

Specified by:
getMergerMaxBufferedDocs in interface LuceneConfig
Returns:

setMergerMaxBufferedDocs

public void setMergerMaxBufferedDocs(int mergerMaxBufferedDocs)
Specified by:
setMergerMaxBufferedDocs in interface LuceneConfig

getMergerTargetIndexCount

public int getMergerTargetIndexCount()
Description copied from interface: LuceneConfig
Target index count. Over this indexes will be merged together.

Specified by:
getMergerTargetIndexCount in interface LuceneConfig
Returns:

setMergerTargetIndexCount

public void setMergerTargetIndexCount(int mergerTargetIndexCount)
Specified by:
setMergerTargetIndexCount in interface LuceneConfig

getMergerTargetOverlayCount

public int getMergerTargetOverlayCount()
Description copied from interface: LuceneConfig
Target overlays (will apply deletions and create indexes if over this limit)

Specified by:
getMergerTargetOverlayCount in interface LuceneConfig
Returns:

setMergerTargetOverlayCount

public void setMergerTargetOverlayCount(int mergerTargetOverlayCount)
Specified by:
setMergerTargetOverlayCount in interface LuceneConfig

getMergerTargetOverlaysBlockingFactor

public int getMergerTargetOverlaysBlockingFactor()
Description copied from interface: LuceneConfig
The factor by which the target overlay count is multiplied to determine the allowable number of overlays before blocking.

Specified by:
getMergerTargetOverlaysBlockingFactor in interface LuceneConfig
Returns:
the factor by which the target overlay count is multiplied to determine the allowable number of overlays before blocking

setMergerTargetOverlaysBlockingFactor

public void setMergerTargetOverlaysBlockingFactor(int mergerTargetOverlaysBlockingFactor)
Specified by:
setMergerTargetOverlaysBlockingFactor in interface LuceneConfig

getFairLocking

public boolean getFairLocking()
Description copied from interface: LuceneConfig
Should we use a 'fair' locking policy, giving queue-like access behaviour to the indexes and avoiding starvation? Default is false since fair locking appears to cause deadlock on old JVMs.

Specified by:
getFairLocking in interface LuceneConfig
Returns:
true if a fair locking policy should be used

setFairLocking

public void setFairLocking(boolean fairLocking)
Specified by:
setFairLocking in interface LuceneConfig

getTermIndexInterval

public int getTermIndexInterval()
Description copied from interface: LuceneConfig
Lucene term index interval

Specified by:
getTermIndexInterval in interface LuceneConfig
Returns:

setTermIndexInterval

public void setTermIndexInterval(int termIndexInterval)
Specified by:
setTermIndexInterval in interface LuceneConfig

getUseNioMemoryMapping

public boolean getUseNioMemoryMapping()
Description copied from interface: LuceneConfig
Use the nio memory mapping (work arounf for bugs with some JVMs)

Specified by:
getUseNioMemoryMapping in interface LuceneConfig
Returns:

setUseNioMemoryMapping

public void setUseNioMemoryMapping(boolean useNioMemoryMapping)
Specified by:
setUseNioMemoryMapping in interface LuceneConfig

getWriterMaxMergeDocs

public int getWriterMaxMergeDocs()
Description copied from interface: LuceneConfig
Lucene writer config

Specified by:
getWriterMaxMergeDocs in interface LuceneConfig
Returns:

setWriterMaxMergeDocs

public void setWriterMaxMergeDocs(int writerMaxMergeDocs)
Specified by:
setWriterMaxMergeDocs in interface LuceneConfig

getWriterMergeFactor

public int getWriterMergeFactor()
Description copied from interface: LuceneConfig
Lucene writer config

Specified by:
getWriterMergeFactor in interface LuceneConfig
Returns:

setWriterMergeFactor

public void setWriterMergeFactor(int writerMergeFactor)
Specified by:
setWriterMergeFactor in interface LuceneConfig

getWriterMaxBufferedDocs

public int getWriterMaxBufferedDocs()
Description copied from interface: LuceneConfig
Lucene writer config

Specified by:
getWriterMaxBufferedDocs in interface LuceneConfig
Returns:

setWriterMaxBufferedDocs

public void setWriterMaxBufferedDocs(int writerMaxBufferedDocs)
Specified by:
setWriterMaxBufferedDocs in interface LuceneConfig

isCacheEnabled

public boolean isCacheEnabled()
Description copied from interface: LuceneConfig
Is caching enabled for each index fragment?

Specified by:
isCacheEnabled in interface LuceneConfig
Returns:

setCacheEnabled

public void setCacheEnabled(boolean cacheEnabled)
Specified by:
setCacheEnabled in interface LuceneConfig

getPostSortDateTime

public boolean getPostSortDateTime()
Description copied from interface: LuceneConfig
If we are using the DateAnalyser then lucene sort is only to the date, as that is all that is in the index. If this is true, a query that defines a sort on a datetime field will do a post sort in Java. For the DateTimeAnalyser no post sort is done. (The default config does do a post sort) In the future, this behaviour may also be set per query on the SearchParameters object.

Specified by:
getPostSortDateTime in interface LuceneConfig
Returns:

setPostSortDateTime

public void setPostSortDateTime(boolean postSortDateTime)
Specified by:
setPostSortDateTime in interface LuceneConfig

getMaxDocsForInMemoryIndex

public int getMaxDocsForInMemoryIndex()
Description copied from interface: LuceneConfig
Max docs to allow for in memory indexes (does no apply to merges)

Specified by:
getMaxDocsForInMemoryIndex in interface LuceneConfig
Returns:
the maxDocsForInMemoryIndex

setMaxDocsForInMemoryIndex

public void setMaxDocsForInMemoryIndex(int maxDocsForInMemoryIndex)
Specified by:
setMaxDocsForInMemoryIndex in interface LuceneConfig
Parameters:
maxDocsForInMemoryIndex - the maxDocsForInMemoryIndex to set

getMaxRamInMbForInMemoryMerge

public double getMaxRamInMbForInMemoryMerge()
Description copied from interface: LuceneConfig
Ram based limit for in memory merges

Specified by:
getMaxRamInMbForInMemoryMerge in interface LuceneConfig
Returns:
the maxRamInMbForInMemoryMerge

setMaxRamInMbForInMemoryMerge

public void setMaxRamInMbForInMemoryMerge(double maxRamInMbForInMemoryMerge)
Specified by:
setMaxRamInMbForInMemoryMerge in interface LuceneConfig
Parameters:
maxRamInMbForInMemoryMerge - the maxRamInMbForInMemoryMerge to set

getMaxRamInMbForInMemoryIndex

public double getMaxRamInMbForInMemoryIndex()
Description copied from interface: LuceneConfig
Max Ram to allow for in memory indexes (does not apply to merges)

Specified by:
getMaxRamInMbForInMemoryIndex in interface LuceneConfig
Returns:
the maxRamInMbForInMemoryIndex

setMaxRamInMbForInMemoryIndex

public void setMaxRamInMbForInMemoryIndex(double maxRamInMbForInMemoryIndex)
Specified by:
setMaxRamInMbForInMemoryIndex in interface LuceneConfig
Parameters:
maxRamInMbForInMemoryIndex - the maxRamInMbForInMemoryIndex to set

getMergerRamBufferSizeMb

public double getMergerRamBufferSizeMb()
Description copied from interface: LuceneConfig
Ram based limit for in memory portion of merger index.

Specified by:
getMergerRamBufferSizeMb in interface LuceneConfig
Returns:
the mergerRamBufferSizeMb

setMergerRamBufferSizeMb

public void setMergerRamBufferSizeMb(double mergerRamBufferSizeMb)
Specified by:
setMergerRamBufferSizeMb in interface LuceneConfig
Parameters:
mergerRamBufferSizeMb - the mergerRamBufferSizeMb to set

getWriterRamBufferSizeMb

public double getWriterRamBufferSizeMb()
Description copied from interface: LuceneConfig
Ram based limit for in memory portion of writer index.

Specified by:
getWriterRamBufferSizeMb in interface LuceneConfig
Returns:
the writerRamBufferSizeMb

setWriterRamBufferSizeMb

public void setWriterRamBufferSizeMb(double writerRamBufferSizeMb)
Specified by:
setWriterRamBufferSizeMb in interface LuceneConfig
Parameters:
writerRamBufferSizeMb - the writerRamBufferSizeMb to set

isContentIndexingEnabled

public boolean isContentIndexingEnabled()
Specified by:
isContentIndexingEnabled in interface LuceneConfig
Returns:
if content indexing is enable.

setContentIndexingEnabled

public void setContentIndexingEnabled(boolean contentIndexingEnabled)
Description copied from interface: LuceneConfig
Enable/Disable the indexing of content Content is not indexed and FTS disabled When disabled, documents are marked as requiring FTS indexing. When enabled the normal FTS process will catch up with content that was not indexed.

Specified by:
setContentIndexingEnabled in interface LuceneConfig

getQueryLanguage

protected LuceneQueryLanguageSPI getQueryLanguage(java.lang.String name)

getAllStores

protected abstract java.util.List getAllStores()

doReadOnly

public java.lang.Object doReadOnly(LuceneIndexerAndSearcher.ReadOnlyWork lockWork)
Specified by:
doReadOnly in interface LuceneIndexerAndSearcher

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

deleteDirectory

public static void deleteDirectory(java.io.File directory)
                            throws java.io.IOException
Throws:
java.io.IOException

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.