public abstract class AbstractLuceneBase extends Object
This class defines where the indexes are stored. This should be via a configurable Bean property in Spring.
The default file structure is
The IndexWriter and IndexReader for a given index are toggled (one should be used for delete and the other for write). These are reused/closed/initialised as required.
The index deltas are buffered to memory and persisted in the file system as required.
| Modifier and Type | Field and Description |
|---|---|
protected String |
deltaId
The identifier for the delta
|
protected org.alfresco.service.cmr.repository.StoreRef |
store
The identifier for the store
|
| Constructor and Description |
|---|
AbstractLuceneBase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeDeltaReader()
Close the on file reader for the delta if it is open
|
protected void |
closeDeltaWriter()
Close the on disk delta writer
|
void |
deleteIndex() |
<R> R |
doReadOnly(IndexInfo.LockWork<R> lockWork)
Execute actions against a read only index (all write ops will block)
|
String |
getDeltaId()
Get the ID for the delat we are working with.
|
protected org.apache.lucene.index.IndexReader |
getDeltaReader()
Get a reader for the on file portion of the delta
|
protected org.apache.lucene.index.IndexWriter |
getDeltaWriter()
Get the on file writer for the delta
|
org.alfresco.service.cmr.dictionary.DictionaryService |
getDictionaryService()
Get the dictionary service.
|
LuceneConfig |
getLuceneConfig()
Get the lucene configuration options.
|
protected org.apache.lucene.index.IndexReader |
getReader() |
protected org.apache.lucene.search.IndexSearcher |
getSearcher()
Get a searcher for the main index TODO: Split out support for the main index.
|
protected ClosingIndexSearcher |
getSearcher(LuceneIndexer luceneIndexer) |
protected TransactionStatus |
getStatus() |
protected void |
initialise(org.alfresco.service.cmr.repository.StoreRef store,
String deltaId)
Initialise the configuration elements of the lucene store indexers and searchers.
|
protected void |
saveDelta()
Save the in memory delta to the disk, make sure there is nothing held in memory
|
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Set the dictionary service
|
protected void |
setInfo(long docs,
Set<String> deletions,
Set<String> containerDeletions,
boolean deleteNodesOnly) |
void |
setLuceneConfig(LuceneConfig config)
Set the lucene configuration options
|
protected void |
setStatus(TransactionStatus status) |
protected org.alfresco.service.cmr.repository.StoreRef store
protected String deltaId
protected void initialise(org.alfresco.service.cmr.repository.StoreRef store,
String deltaId)
throws LuceneIndexException
store - StoreRefdeltaId - StringLuceneIndexExceptionprotected org.apache.lucene.search.IndexSearcher getSearcher()
throws LuceneIndexException
LuceneIndexExceptionprotected ClosingIndexSearcher getSearcher(LuceneIndexer luceneIndexer) throws LuceneIndexException
LuceneIndexExceptionprotected org.apache.lucene.index.IndexReader getDeltaReader()
throws LuceneIndexException,
IOException
IOExceptionIOExceptionLuceneIndexExceptionprotected void closeDeltaReader()
throws LuceneIndexException,
IOException
protected org.apache.lucene.index.IndexWriter getDeltaWriter()
throws LuceneIndexException,
IOException
IOExceptionIOExceptionLuceneIndexExceptionprotected void closeDeltaWriter()
throws LuceneIndexException,
IOException
protected void saveDelta()
throws LuceneIndexException,
IOException
protected void setInfo(long docs,
Set<String> deletions,
Set<String> containerDeletions,
boolean deleteNodesOnly)
throws IOException
IOExceptionprotected void setStatus(TransactionStatus status) throws IOException
IOExceptionprotected TransactionStatus getStatus()
protected org.apache.lucene.index.IndexReader getReader()
throws LuceneIndexException,
IOException
LuceneIndexExceptionIOExceptionpublic void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
dictionaryService - DictionaryServicepublic org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
public void setLuceneConfig(LuceneConfig config)
config - LuceneConfigpublic LuceneConfig getLuceneConfig()
public String getDeltaId()
public <R> R doReadOnly(IndexInfo.LockWork<R> lockWork)
public void deleteIndex()
Copyright © 2005–2018 Alfresco Software. All rights reserved.