Class MultiIndex
- java.lang.Object
-
- org.apache.jackrabbit.core.query.lucene.MultiIndex
-
public class MultiIndex extends Object
AMultiIndex
consists of aVolatileIndex
and multiplePersistentIndex
es. The goal is to keep most parts of the index open with index readers and write new index data to the volatile index. When the volatile index reaches a certain size (seeSearchIndex.setMinMergeDocs(int)
) a new persistent index is created with the index data from the volatile index, the same happens when the volatile index has been idle for some time (seeSearchIndex.setVolatileIdleTime(int)
). The new persistent index is then added to the list of already existing persistent indexes. Further operations on the new persistent index will however only require anIndexReader
which serves for queries but also for delete operations on the index.The persistent indexes are merged from time to time. The merge behaviour is configurable using the methods:
SearchIndex.setMaxMergeDocs(int)
,SearchIndex.setMergeFactor(int)
andSearchIndex.setMinMergeDocs(int)
. For detailed description of the configuration parameters see also the luceneIndexWriter
class.This class is thread-safe.
Note on implementation: Multiple modifying threads are synchronized on a
MultiIndex
instance itself. Synchronization between a modifying thread and reader threads is done usingupdateMonitor
andupdateInProgress
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultiIndex.Action
Defines an action on anMultiIndex
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CachingMultiIndexReader
getIndexReader()
Returns an read-onlyIndexReader
that spans alls indexes of thisMultiIndex
.CachingMultiIndexReader
getIndexReader(boolean initCache)
Returns an read-onlyIndexReader
that spans alls indexes of thisMultiIndex
.
-
-
-
Method Detail
-
getIndexReader
public CachingMultiIndexReader getIndexReader() throws IOException
Returns an read-onlyIndexReader
that spans alls indexes of thisMultiIndex
.- Returns:
- an
IndexReader
. - Throws:
IOException
- if an error occurs constructing theIndexReader
.
-
getIndexReader
public CachingMultiIndexReader getIndexReader(boolean initCache) throws IOException
Returns an read-onlyIndexReader
that spans alls indexes of thisMultiIndex
.- Parameters:
initCache
- when settrue
the hierarchy cache is completely initialized before this call returns.- Returns:
- an
IndexReader
. - Throws:
IOException
- if an error occurs constructing theIndexReader
.
-
-