public class RandomIndexWriter extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
org.apache.lucene.index.IndexWriter |
w |
| Constructor and Description |
|---|
RandomIndexWriter(Random r,
org.apache.lucene.store.Directory dir)
create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and Whitespace+LowercasingAnalyzer
|
RandomIndexWriter(Random r,
org.apache.lucene.store.Directory dir,
org.apache.lucene.analysis.Analyzer a)
create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT
|
RandomIndexWriter(Random r,
org.apache.lucene.store.Directory dir,
org.apache.lucene.index.IndexWriterConfig c)
create a RandomIndexWriter with the provided config
|
RandomIndexWriter(Random r,
org.apache.lucene.store.Directory dir,
org.apache.lucene.util.Version v,
org.apache.lucene.analysis.Analyzer a)
create a RandomIndexWriter with a random config
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDocument(org.apache.lucene.document.Document doc)
Adds a Document.
|
void |
addDocuments(Collection<org.apache.lucene.document.Document> docs) |
void |
addIndexes(org.apache.lucene.store.Directory... dirs) |
void |
addIndexes(org.apache.lucene.index.IndexReader... readers) |
void |
close()
Close this writer.
|
void |
commit() |
void |
deleteAll() |
void |
deleteDocuments(org.apache.lucene.search.Query q) |
void |
deleteDocuments(org.apache.lucene.index.Term term) |
void |
forceMerge(int maxSegmentCount)
Forces a forceMerge.
|
void |
forceMergeDeletes() |
void |
forceMergeDeletes(boolean doWait) |
org.apache.lucene.index.IndexReader |
getReader() |
org.apache.lucene.index.IndexReader |
getReader(boolean applyDeletions) |
int |
maxDoc() |
int |
numDocs() |
void |
setDoRandomForceMerge(boolean v) |
void |
setDoRandomForceMergeAssert(boolean v) |
void |
updateDocument(org.apache.lucene.index.Term t,
org.apache.lucene.document.Document doc)
Updates a document.
|
void |
updateDocuments(org.apache.lucene.index.Term delTerm,
Collection<org.apache.lucene.document.Document> docs) |
public RandomIndexWriter(Random r, org.apache.lucene.store.Directory dir) throws IOException
IOExceptionpublic RandomIndexWriter(Random r, org.apache.lucene.store.Directory dir, org.apache.lucene.analysis.Analyzer a) throws IOException
IOExceptionpublic RandomIndexWriter(Random r, org.apache.lucene.store.Directory dir, org.apache.lucene.util.Version v, org.apache.lucene.analysis.Analyzer a) throws IOException
IOExceptionpublic RandomIndexWriter(Random r, org.apache.lucene.store.Directory dir, org.apache.lucene.index.IndexWriterConfig c) throws IOException
IOExceptionpublic void addDocument(org.apache.lucene.document.Document doc)
throws IOException
IOExceptionIndexWriter.addDocument(Document)public void addDocuments(Collection<org.apache.lucene.document.Document> docs) throws IOException
IOExceptionpublic void updateDocuments(org.apache.lucene.index.Term delTerm,
Collection<org.apache.lucene.document.Document> docs)
throws IOException
IOExceptionpublic void updateDocument(org.apache.lucene.index.Term t,
org.apache.lucene.document.Document doc)
throws IOException
IOExceptionIndexWriter.updateDocument(Term, Document)public void addIndexes(org.apache.lucene.store.Directory... dirs)
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void addIndexes(org.apache.lucene.index.IndexReader... readers)
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void deleteDocuments(org.apache.lucene.index.Term term)
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void deleteDocuments(org.apache.lucene.search.Query q)
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void commit()
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic int numDocs()
throws IOException
IOExceptionpublic int maxDoc()
public void deleteAll()
throws IOException
IOExceptionpublic void forceMergeDeletes(boolean doWait)
throws IOException
IOExceptionpublic void forceMergeDeletes()
throws IOException
IOExceptionpublic void setDoRandomForceMerge(boolean v)
public void setDoRandomForceMergeAssert(boolean v)
public org.apache.lucene.index.IndexReader getReader()
throws IOException
IOExceptionpublic org.apache.lucene.index.IndexReader getReader(boolean applyDeletions)
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionIndexWriter.close()public void forceMerge(int maxSegmentCount)
throws IOException
NOTE: this should be avoided in tests unless absolutely necessary, as it will result in less test coverage.
IOExceptionIndexWriter.forceMerge(int)Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.