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
| Modifier and Type | Class and Description |
|---|---|
static class |
IncrementalIndex.Loader |
Index.UpdatingCollectionStatistics| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
MemoryIndex |
memory |
String |
path |
String |
prefix |
int |
prefixID |
indices, selectiveMatchingPolicydirtyProperties, 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 |
|---|---|
boolean |
addToDocument(int docid,
Document doc)
Adds specified content contents to the named document id.
|
boolean |
addToDocument(int docid,
DocumentPostingList docContents)
Adds relevant terms to the named document id.
|
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.
|
boolean |
removeDocument(int docid)
Removes a document from the index.
|
void |
setPath(String path) |
void |
setPrefix(String prefix) |
void |
setPrefixID(int prefixID) |
getCollectionStatistics, getDirectIndex, getDocumentIndex, getIndexStructure, getIndexStructureInputStream, getInvertedIndex, getIthShard, getLexicon, getMetaIndex, getNumberOfShards, toStringaddIndexStructure, addIndexStructure, addIndexStructure, addIndexStructure, addIndexStructureInputStream, addIndexStructureInputStream, addIndexStructureInputStream, addIndexStructureInputStream, allExists, createIndex, createIndex, createNewIndex, existsIndex, getEnd, getIndexLoadingProfileAsRetrieval, getIndexProperty, getIndexRef, getIntIndexProperty, getLastIndexLoadError, getProperties, getStart, hasIndexStructure, hasIndexStructureInputStream, join, main, setIndexLoadingProfileAsRetrieval, setIndexPropertyprotected static final org.slf4j.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 UpdatableIndexExceptionpublic void indexDocument(Map<String,String> docProperties, DocumentPostingList docContents) throws Exception
indexDocument in interface UpdatableIndexExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class MultiIndexIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class MultiIndexIOExceptionpublic 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)
public boolean removeDocument(int docid)
UpdatableIndexremoveDocument in interface UpdatableIndexpublic boolean addToDocument(int docid,
Document doc)
throws Exception
UpdatableIndexaddToDocument in interface UpdatableIndexExceptionpublic boolean addToDocument(int docid,
DocumentPostingList docContents)
throws Exception
UpdatableIndexaddToDocument in interface UpdatableIndexExceptionTerrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow