public class IncrementalIndex extends MultiIndex implements UpdatableIndex
This is the main Index class for an incremental index. An incremental index is a MultiIndex where one index shard is stored in memory and the rest are stored on disk. Periodically, the memory index is then written do disk, defined as per a FlushPolicy. When the memory index has been flushed to disk, optionally the on-disk portion of the incremental index can then be merged together (based upon a MergePolicy) and/or deleted (based upon a DeletePolicy).
Properties
Index.UpdatingCollectionStatistics
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
logger |
MemoryIndex |
memory |
String |
path |
String |
prefix |
int |
prefixID |
indices, selectiveMatchingPolicy
dirtyProperties, EMPTY_CLASS_ARRAY, lastLoadError, MINIMUM_INDEX_TERRIER_VERSION, properties, PROPERTIES_SUFFIX, RETRIEVAL_LOADING_PROFILE
Modifier | Constructor and Description |
---|---|
protected |
IncrementalIndex(Index[] indices) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the data structures of the index.
|
void |
flush()
Write any dirty data structures down to disk
|
static IncrementalIndex |
get(String path,
String prefix)
Construct a new incremental index.
|
String |
getPath() |
String |
getPrefix() |
int |
getPrefixID() |
String |
getTimeOfLastUpdate()
This method prints out the last time this index was updated as a String in GMT format
|
void |
indexDocument(Document doc)
Update the index with a new document.
|
void |
indexDocument(Map<String,String> docProperties,
DocumentPostingList docContents)
Update the index with a new document.
|
void |
setPath(String path) |
void |
setPrefix(String prefix) |
void |
setPrefixID(int prefixID) |
getCollectionStatistics, getDirectIndex, getDocumentIndex, getIndexStructure, getIndexStructureInputStream, getInvertedIndex, getIthShard, getLexicon, getMetaIndex, getNumberOfShards, toString
addIndexStructure, addIndexStructure, addIndexStructure, addIndexStructure, addIndexStructureInputStream, addIndexStructureInputStream, addIndexStructureInputStream, addIndexStructureInputStream, allExists, createIndex, createIndex, createNewIndex, existsIndex, getEnd, getIndexLoadingProfileAsRetrieval, getIndexProperty, getIntIndexProperty, getLastIndexLoadError, getProperties, getStart, hasIndexStructure, hasIndexStructureInputStream, join, main, setIndexLoadingProfileAsRetrieval, setIndexProperty
protected static final org.apache.log4j.Logger logger
public MemoryIndex memory
public String path
public String prefix
public int prefixID
protected IncrementalIndex(Index[] indices)
public static IncrementalIndex get(String path, String prefix)
public void indexDocument(Document doc) throws Exception
indexDocument
in interface UpdatableIndex
Exception
public void indexDocument(Map<String,String> docProperties, DocumentPostingList docContents) throws Exception
indexDocument
in interface UpdatableIndex
Exception
public void flush() throws IOException
flush
in interface Flushable
flush
in class MultiIndex
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class MultiIndex
IOException
public String getTimeOfLastUpdate()
public String getPath()
public void setPath(String path)
public String getPrefix()
public void setPrefix(String prefix)
public int getPrefixID()
public void setPrefixID(int prefixID)
Terrier 4.0. Copyright © 2004-2014 University of Glasgow