public class RandomIndexWriter extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
IndexWriter |
w |
Constructor and Description |
---|
RandomIndexWriter(Random r,
Directory dir)
create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and Whitespace+LowercasingAnalyzer
|
RandomIndexWriter(Random r,
Directory dir,
Analyzer a)
create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT
|
RandomIndexWriter(Random r,
Directory dir,
IndexWriterConfig c)
create a RandomIndexWriter with the provided config
|
RandomIndexWriter(Random r,
Directory dir,
Version v,
Analyzer a)
create a RandomIndexWriter with a random config
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(Document doc)
Adds a Document.
|
void |
addDocuments(Collection<Document> docs) |
void |
addIndexes(Directory... dirs) |
void |
addIndexes(IndexReader... readers) |
void |
close()
Close this writer.
|
void |
commit() |
void |
deleteAll() |
void |
deleteDocuments(Query q) |
void |
deleteDocuments(Term term) |
void |
forceMerge(int maxSegmentCount)
Forces a forceMerge.
|
void |
forceMergeDeletes() |
void |
forceMergeDeletes(boolean doWait) |
IndexReader |
getReader() |
IndexReader |
getReader(boolean applyDeletions) |
int |
maxDoc() |
int |
numDocs() |
void |
setDoRandomForceMerge(boolean v) |
void |
setDoRandomForceMergeAssert(boolean v) |
void |
updateDocument(Term t,
Document doc)
Updates a document.
|
void |
updateDocuments(Term delTerm,
Collection<Document> docs) |
public IndexWriter w
public RandomIndexWriter(Random r, Directory dir) throws IOException
IOException
public RandomIndexWriter(Random r, Directory dir, Analyzer a) throws IOException
IOException
public RandomIndexWriter(Random r, Directory dir, Version v, Analyzer a) throws IOException
IOException
public RandomIndexWriter(Random r, Directory dir, IndexWriterConfig c) throws IOException
IOException
public void addDocument(Document doc) throws IOException
IOException
IndexWriter.addDocument(Document)
public void addDocuments(Collection<Document> docs) throws IOException
IOException
public void updateDocuments(Term delTerm, Collection<Document> docs) throws IOException
IOException
public void updateDocument(Term t, Document doc) throws IOException
IOException
IndexWriter.updateDocument(Term, Document)
public void addIndexes(Directory... dirs) throws CorruptIndexException, IOException
CorruptIndexException
IOException
public void addIndexes(IndexReader... readers) throws CorruptIndexException, IOException
CorruptIndexException
IOException
public void deleteDocuments(Term term) throws CorruptIndexException, IOException
CorruptIndexException
IOException
public void deleteDocuments(Query q) throws CorruptIndexException, IOException
CorruptIndexException
IOException
public void commit() throws CorruptIndexException, IOException
CorruptIndexException
IOException
public int numDocs() throws IOException
IOException
public int maxDoc()
public void deleteAll() throws IOException
IOException
public void forceMergeDeletes(boolean doWait) throws IOException
IOException
public void forceMergeDeletes() throws IOException
IOException
public void setDoRandomForceMerge(boolean v)
public void setDoRandomForceMergeAssert(boolean v)
public IndexReader getReader() throws IOException
IOException
public IndexReader getReader(boolean applyDeletions) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
IOException
IndexWriter.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.
IOException
IndexWriter.forceMerge(int)