public class IndexInfo extends java.lang.Object implements IndexMonitor
The index structure is duplicated to two files. If one is currupted the second is used.
TODO:
| Modifier and Type | Class and Description |
|---|---|
static interface |
IndexInfo.LockWork |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MAIN_READER |
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationListener(org.springframework.context.ApplicationListener listener)
Registers a listener for events on this index.
|
void |
closeDelta(java.lang.String id)
Make sure the writer and reader for TX data are closed.
|
void |
closeDeltaIndexReader(java.lang.String id)
Manage closing and unregistering an index reader.
|
void |
closeDeltaIndexWriter(java.lang.String id)
Manage closing and unregistering an index writer .
|
void |
delete(java.lang.String deltaId) |
static void |
destroy() |
void |
destroyInstance() |
java.lang.Object |
doReadOnly(IndexInfo.LockWork lockWork) |
long |
getActualSize()
Gets the actual size of the index in bytes.
|
java.util.Set |
getDeletions(java.lang.String id)
Get the deletions for a given index (there is no check if they should be applied that is up to the calling layer)
|
org.apache.lucene.index.IndexReader |
getDeltaIndexReader(java.lang.String id)
This method should only be called from one thread as it is bound to a transaction.
|
org.apache.lucene.index.IndexWriter |
getDeltaIndexWriter(java.lang.String id,
org.apache.lucene.analysis.Analyzer analyzer)
Manage getting a lucene index writer for transactional data - looks after registration and checking there is no
active reader.
|
static IndexInfo |
getIndexInfo(java.io.File file,
LuceneConfig config)
Get the IndexInfo object based in the given directory.
|
org.apache.lucene.index.IndexReader |
getMainIndexReferenceCountingReadOnlyIndexReader()
Get the main reader for committed index data
|
org.apache.lucene.index.IndexReader |
getMainIndexReferenceCountingReadOnlyIndexReader(java.lang.String id,
java.util.Set deletions,
java.util.Set containerDeletions,
boolean deleteOnlyNodes)
Get the main index reader augmented with the specified TX data As above but we add the TX data
|
int |
getNumberOfDocuments()
Gets the number of documents in the index.
|
int |
getNumberOfFields()
Gets the number of fields known to the index.
|
int |
getNumberOfIndexedFields()
Gets the number of indexed fields.
|
java.lang.String |
getRelativePath()
Gets the relative path of the index directory.
|
java.util.Map |
getStatusSnapshot()
Gets a snapshot of the statuses of the individual entries in this index.
|
long |
getUsedSize()
Gets the size used on disk by the index directory.
|
static void |
main(java.lang.String[] args)
Helper to print out index information
|
void |
setPreparedState(java.lang.String id,
java.util.Set toDelete,
java.util.Set containersToDelete,
long documents,
boolean deleteNodesOnly)
Set the aux data for the index entry for a transactional unit of work.
|
void |
setStatus(java.lang.String id,
TransactionStatus state,
java.util.Set toDelete,
java.util.Set read) |
java.lang.String |
toString() |
public static final java.lang.String MAIN_READER
public static void destroy()
public void destroyInstance()
public void delete(java.lang.String deltaId)
public static IndexInfo getIndexInfo(java.io.File file, LuceneConfig config) throws IndexerException
file - IndexerExceptionpublic org.apache.lucene.index.IndexReader getDeltaIndexReader(java.lang.String id)
throws java.io.IOException
id - java.io.IOExceptionpublic org.apache.lucene.index.IndexWriter getDeltaIndexWriter(java.lang.String id,
org.apache.lucene.analysis.Analyzer analyzer)
throws java.io.IOException
id - analyzer - java.io.IOExceptionpublic void closeDeltaIndexReader(java.lang.String id)
throws java.io.IOException
id - java.io.IOExceptionpublic void closeDeltaIndexWriter(java.lang.String id)
throws java.io.IOException
id - java.io.IOExceptionpublic void closeDelta(java.lang.String id)
throws java.io.IOException
id - java.io.IOExceptionpublic java.util.Set getDeletions(java.lang.String id)
throws java.io.IOException
id - java.io.IOExceptionpublic void setPreparedState(java.lang.String id,
java.util.Set toDelete,
java.util.Set containersToDelete,
long documents,
boolean deleteNodesOnly)
throws java.io.IOException
id - -
the tx idtoDelete - -
noderefs that should be deleted from previous indexes (not this one)documents - -
the number of docs in the indexdeleteNodesOnly - -
should deletions on apply to nodes (ie not to containers)java.io.IOExceptionpublic org.apache.lucene.index.IndexReader getMainIndexReferenceCountingReadOnlyIndexReader()
throws java.io.IOException
java.io.IOExceptionpublic org.apache.lucene.index.IndexReader getMainIndexReferenceCountingReadOnlyIndexReader(java.lang.String id,
java.util.Set deletions,
java.util.Set containerDeletions,
boolean deleteOnlyNodes)
throws java.io.IOException
id - deletions - deleteOnlyNodes - java.io.IOExceptionpublic void setStatus(java.lang.String id,
TransactionStatus state,
java.util.Set toDelete,
java.util.Set read)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object doReadOnly(IndexInfo.LockWork lockWork)
public static void main(java.lang.String[] args)
throws java.lang.Throwable
args - java.lang.Throwablepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRelativePath()
IndexMonitorgetRelativePath in interface IndexMonitorpublic java.util.Map getStatusSnapshot()
IndexMonitorgetStatusSnapshot in interface IndexMonitorpublic long getActualSize()
throws java.io.IOException
IndexMonitorgetActualSize in interface IndexMonitorjava.io.IOException - Signals that an I/O exception has occurred.public long getUsedSize()
throws java.io.IOException
IndexMonitorIndexMonitor.getActualSize() may indicate that there are unused data files.getUsedSize in interface IndexMonitorjava.io.IOException - Signals that an I/O exception has occurred.public int getNumberOfDocuments()
throws java.io.IOException
IndexMonitorgetNumberOfDocuments in interface IndexMonitorjava.io.IOException - Signals that an I/O exception has occurred.public int getNumberOfFields()
throws java.io.IOException
IndexMonitorgetNumberOfFields in interface IndexMonitorjava.io.IOException - Signals that an I/O exception has occurred.public int getNumberOfIndexedFields()
throws java.io.IOException
IndexMonitorgetNumberOfIndexedFields in interface IndexMonitorjava.io.IOException - Signals that an I/O exception has occurred.public void addApplicationListener(org.springframework.context.ApplicationListener listener)
IndexMonitoraddApplicationListener in interface IndexMonitorlistener - the listenerCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.