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