public abstract class AbstractLuceneBase
extends java.lang.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 java.lang.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() |
java.lang.Object |
doReadOnly(IndexInfo.LockWork lockWork)
Execute actions against a read only index (all write ops will block)
|
java.lang.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,
java.lang.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,
java.util.Set deletions,
java.util.Set 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 java.lang.String deltaId
protected void initialise(org.alfresco.service.cmr.repository.StoreRef store,
java.lang.String deltaId)
throws LuceneIndexException
store - deltaId - java.io.IOExceptionLuceneIndexExceptionprotected org.apache.lucene.search.IndexSearcher getSearcher()
throws LuceneIndexException
java.io.IOExceptionLuceneIndexExceptionprotected ClosingIndexSearcher getSearcher(LuceneIndexer luceneIndexer) throws LuceneIndexException
LuceneIndexExceptionprotected org.apache.lucene.index.IndexReader getDeltaReader()
throws LuceneIndexException,
java.io.IOException
java.io.IOExceptionjava.io.IOExceptionLuceneIndexExceptionprotected void closeDeltaReader()
throws LuceneIndexException,
java.io.IOException
java.io.IOExceptionjava.io.IOExceptionLuceneIndexExceptionprotected org.apache.lucene.index.IndexWriter getDeltaWriter()
throws LuceneIndexException,
java.io.IOException
java.io.IOExceptionjava.io.IOExceptionLuceneIndexExceptionprotected void closeDeltaWriter()
throws LuceneIndexException,
java.io.IOException
java.io.IOExceptionjava.io.IOExceptionLuceneIndexExceptionprotected void saveDelta()
throws LuceneIndexException,
java.io.IOException
java.io.IOExceptionjava.io.IOExceptionLuceneIndexExceptionprotected void setInfo(long docs,
java.util.Set deletions,
java.util.Set containerDeletions,
boolean deleteNodesOnly)
throws java.io.IOException
java.io.IOExceptionprotected void setStatus(TransactionStatus status) throws java.io.IOException
java.io.IOExceptionprotected TransactionStatus getStatus()
protected org.apache.lucene.index.IndexReader getReader()
throws LuceneIndexException,
java.io.IOException
LuceneIndexExceptionjava.io.IOExceptionpublic void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
dictionaryService - public org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
public void setLuceneConfig(LuceneConfig config)
config - public LuceneConfig getLuceneConfig()
public java.lang.String getDeltaId()
public java.lang.Object doReadOnly(IndexInfo.LockWork lockWork)
lockWork - public void deleteIndex()
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.