Class InstantiatedIndexWriter
- java.lang.Object
-
- org.apache.lucene.store.instantiated.InstantiatedIndexWriter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
@Deprecated public class InstantiatedIndexWriter extends Object implements Closeable
Deprecated.contrib/instantiated will be removed in 4.0; you can use the memory codec to hold all postings in RAMThis class, similar toIndexWriter
, has no locking mechanism.InstantiatedIndexReader
is navigating the same instances in memory as this writer is updating so searchers active while you are committing are bound to throw exceptions.Consider using InstantiatedIndex as if it was immutable.
- See Also:
IndexWriter
-
-
Constructor Summary
Constructors Constructor Description InstantiatedIndexWriter(InstantiatedIndex index)
Deprecated.InstantiatedIndexWriter(InstantiatedIndex index, org.apache.lucene.analysis.Analyzer analyzer)
Deprecated.InstantiatedIndexWriter(InstantiatedIndex index, org.apache.lucene.analysis.Analyzer analyzer, boolean create)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
abort()
Deprecated.void
addDocument(org.apache.lucene.document.Document doc)
Deprecated.Adds a document to this index.void
addDocument(org.apache.lucene.document.Document doc, org.apache.lucene.analysis.Analyzer analyzer)
Deprecated.Adds a document to this index, using the provided analyzer instead of the value ofgetAnalyzer()
.protected void
addDocument(InstantiatedDocument document, org.apache.lucene.analysis.Analyzer analyzer)
Deprecated.Tokenizes a document and adds it to the buffer.void
addIndexes(org.apache.lucene.index.IndexReader[] readers)
Deprecated.void
close()
Deprecated.Flushes all changes to an index and closes all associated files.void
commit()
Deprecated.Locks the index and commits the buffered documents.void
deleteDocuments(org.apache.lucene.index.Term term)
Deprecated.void
deleteDocuments(org.apache.lucene.index.Term[] terms)
Deprecated.int
docCount()
Deprecated.Returns the number of documents currently in this index.org.apache.lucene.analysis.Analyzer
getAnalyzer()
Deprecated.PrintStream
getInfoStream()
Deprecated.int
getMaxFieldLength()
Deprecated.int
getMergeFactor()
Deprecated.org.apache.lucene.search.Similarity
getSimilarity()
Deprecated.void
setInfoStream(PrintStream infoStream)
Deprecated.If non-null, information about merges and a message when maxFieldLength is reached could be printed to this -- currently not yet implemented.void
setMaxFieldLength(int maxFieldLength)
Deprecated.void
setMergeFactor(int mergeFactor)
Deprecated.The sweetspot for this implementation is somewhere around 2500 at 2K text large documents.void
setSimilarity(org.apache.lucene.search.Similarity similarity)
Deprecated.void
updateDocument(org.apache.lucene.index.Term term, org.apache.lucene.document.Document doc)
Deprecated.void
updateDocument(org.apache.lucene.index.Term term, org.apache.lucene.document.Document doc, org.apache.lucene.analysis.Analyzer analyzer)
Deprecated.
-
-
-
Constructor Detail
-
InstantiatedIndexWriter
public InstantiatedIndexWriter(InstantiatedIndex index) throws IOException
Deprecated.- Throws:
IOException
-
InstantiatedIndexWriter
public InstantiatedIndexWriter(InstantiatedIndex index, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
Deprecated.- Throws:
IOException
-
InstantiatedIndexWriter
public InstantiatedIndexWriter(InstantiatedIndex index, org.apache.lucene.analysis.Analyzer analyzer, boolean create) throws IOException
Deprecated.- Throws:
IOException
-
-
Method Detail
-
setMergeFactor
public void setMergeFactor(int mergeFactor)
Deprecated.The sweetspot for this implementation is somewhere around 2500 at 2K text large documents. Benchmark output:------------> Report sum by Prefix (MAddDocs) and Round (8 about 8 out of 160153) Operation round mrg buf cmpnd runCnt recsPerRun rec/s elapsedSec avgUsedMem avgTotalMem MAddDocs_20000 0 10 10 true 1 20000 81,4 245,68 200 325 152 268 156 928 MAddDocs_20000 - 1 1000 10 true - - 1 - - 20000 - - 494,1 - - 40,47 - 247 119 072 - 347 025 408 MAddDocs_20000 2 10 100 true 1 20000 104,8 190,81 233 895 552 363 720 704 MAddDocs_20000 - 3 2000 100 true - - 1 - - 20000 - - 527,2 - - 37,94 - 266 136 448 - 378 273 792 MAddDocs_20000 4 10 10 false 1 20000 103,2 193,75 222 089 792 378 273 792 MAddDocs_20000 - 5 3000 10 false - - 1 - - 20000 - - 545,2 - - 36,69 - 237 917 152 - 378 273 792 MAddDocs_20000 6 10 100 false 1 20000 102,7 194,67 237 018 976 378 273 792 MAddDocs_20000 - 7 4000 100 false - - 1 - - 20000 - - 535,8 - - 37,33 - 309 680 640 - 501 968 896
- See Also:
LogMergePolicy.setMergeFactor(int)
-
getMergeFactor
public int getMergeFactor()
Deprecated.- See Also:
LogMergePolicy.getMergeFactor()
-
setInfoStream
public void setInfoStream(PrintStream infoStream)
Deprecated.If non-null, information about merges and a message when maxFieldLength is reached could be printed to this -- currently not yet implemented.
-
abort
public void abort() throws IOException
Deprecated.- Throws:
IOException
-
addIndexes
public void addIndexes(org.apache.lucene.index.IndexReader[] readers)
Deprecated.
-
getInfoStream
public PrintStream getInfoStream()
Deprecated.
-
close
public void close() throws IOException
Deprecated.Flushes all changes to an index and closes all associated files.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
docCount
public int docCount()
Deprecated.Returns the number of documents currently in this index.
-
commit
public void commit() throws IOException
Deprecated.Locks the index and commits the buffered documents.- Throws:
IOException
-
addDocument
public void addDocument(org.apache.lucene.document.Document doc) throws IOException
Deprecated.Adds a document to this index. If the document contains more thansetMaxFieldLength(int)
terms for a given field, the remainder are discarded.- Throws:
IOException
-
addDocument
public void addDocument(org.apache.lucene.document.Document doc, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
Deprecated.Adds a document to this index, using the provided analyzer instead of the value ofgetAnalyzer()
. If the document contains more thansetMaxFieldLength(int)
terms for a given field, the remainder are discarded.- Parameters:
doc
-analyzer
-- Throws:
IOException
-
addDocument
protected void addDocument(InstantiatedDocument document, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
Deprecated.Tokenizes a document and adds it to the buffer. Try to do all calculations in this method rather than in commit, as this is a non locking method. Remember, this index implementation expects unlimited memory for maximum speed.- Parameters:
document
-analyzer
-- Throws:
IOException
-
deleteDocuments
public void deleteDocuments(org.apache.lucene.index.Term term) throws IOException
Deprecated.- Throws:
IOException
-
deleteDocuments
public void deleteDocuments(org.apache.lucene.index.Term[] terms) throws IOException
Deprecated.- Throws:
IOException
-
updateDocument
public void updateDocument(org.apache.lucene.index.Term term, org.apache.lucene.document.Document doc) throws IOException
Deprecated.- Throws:
IOException
-
updateDocument
public void updateDocument(org.apache.lucene.index.Term term, org.apache.lucene.document.Document doc, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
Deprecated.- Throws:
IOException
-
getMaxFieldLength
public int getMaxFieldLength()
Deprecated.
-
setMaxFieldLength
public void setMaxFieldLength(int maxFieldLength)
Deprecated.
-
getSimilarity
public org.apache.lucene.search.Similarity getSimilarity()
Deprecated.
-
setSimilarity
public void setSimilarity(org.apache.lucene.search.Similarity similarity)
Deprecated.
-
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer()
Deprecated.
-
-