public class RandomIndexWriter
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
RandomIndexWriter.TestPoint
Simple interface that is executed for each TP
InfoStream component
message. |
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 MockAnalyzer
|
RandomIndexWriter(java.util.Random r,
Directory dir,
Analyzer a)
create a RandomIndexWriter with a random config
|
RandomIndexWriter(java.util.Random r,
Directory dir,
IndexWriterConfig c)
create a RandomIndexWriter with the provided config
|
RandomIndexWriter(java.util.Random r,
Directory dir,
IndexWriterConfig c,
boolean useSoftDeletes)
create a RandomIndexWriter with the provided config
|
Modifier and Type | Method and Description |
---|---|
<T extends IndexableField> |
addDocument(java.lang.Iterable<T> doc)
Adds a Document.
|
long |
addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) |
long |
addIndexes(CodecReader... readers) |
long |
addIndexes(Directory... dirs) |
void |
close()
Close this writer.
|
long |
commit() |
long |
deleteAll() |
long |
deleteDocuments(Query q) |
long |
deleteDocuments(Term term) |
void |
flush()
Writes all in-memory segments to the
Directory . |
void |
forceMerge(int maxSegmentCount)
Forces a forceMerge.
|
void |
forceMergeDeletes() |
void |
forceMergeDeletes(boolean doWait) |
IndexWriter.DocStats |
getDocStats() |
DirectoryReader |
getReader() |
DirectoryReader |
getReader(boolean applyDeletions,
boolean writeAllDeletes) |
static IndexWriter |
mockIndexWriter(Directory dir,
IndexWriterConfig conf,
java.util.Random r)
Returns an indexwriter that randomly mixes up thread scheduling (by yielding at test points)
|
static IndexWriter |
mockIndexWriter(java.util.Random r,
Directory dir,
IndexWriterConfig conf,
RandomIndexWriter.TestPoint testPoint)
Returns an indexwriter that enables the specified test point
|
void |
setDoRandomForceMerge(boolean v) |
void |
setDoRandomForceMergeAssert(boolean v) |
long |
updateBinaryDocValue(Term term,
java.lang.String field,
BytesRef value) |
<T extends IndexableField> |
updateDocument(Term t,
java.lang.Iterable<T> doc)
Updates a document.
|
long |
updateDocuments(Term delTerm,
java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) |
long |
updateDocValues(Term term,
Field... updates) |
long |
updateNumericDocValue(Term term,
java.lang.String field,
java.lang.Long value) |
public final IndexWriter w
public RandomIndexWriter(java.util.Random r, Directory dir) throws java.io.IOException
java.io.IOException
public RandomIndexWriter(java.util.Random r, Directory dir, Analyzer a) throws java.io.IOException
java.io.IOException
public RandomIndexWriter(java.util.Random r, Directory dir, IndexWriterConfig c) throws java.io.IOException
java.io.IOException
public RandomIndexWriter(java.util.Random r, Directory dir, IndexWriterConfig c, boolean useSoftDeletes) throws java.io.IOException
java.io.IOException
public static IndexWriter mockIndexWriter(Directory dir, IndexWriterConfig conf, java.util.Random r) throws java.io.IOException
java.io.IOException
public static IndexWriter mockIndexWriter(java.util.Random r, Directory dir, IndexWriterConfig conf, RandomIndexWriter.TestPoint testPoint) throws java.io.IOException
java.io.IOException
public <T extends IndexableField> long addDocument(java.lang.Iterable<T> doc) throws java.io.IOException
java.io.IOException
IndexWriter.addDocument(Iterable)
public long addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) throws java.io.IOException
java.io.IOException
public long updateDocuments(Term delTerm, java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) throws java.io.IOException
java.io.IOException
public <T extends IndexableField> long updateDocument(Term t, java.lang.Iterable<T> doc) throws java.io.IOException
java.io.IOException
IndexWriter.updateDocument(Term, Iterable)
public long addIndexes(Directory... dirs) throws java.io.IOException
java.io.IOException
public long addIndexes(CodecReader... readers) throws java.io.IOException
java.io.IOException
public long updateNumericDocValue(Term term, java.lang.String field, java.lang.Long value) throws java.io.IOException
java.io.IOException
public long updateBinaryDocValue(Term term, java.lang.String field, BytesRef value) throws java.io.IOException
java.io.IOException
public long updateDocValues(Term term, Field... updates) throws java.io.IOException
java.io.IOException
public long deleteDocuments(Term term) throws java.io.IOException
java.io.IOException
public long deleteDocuments(Query q) throws java.io.IOException
java.io.IOException
public long commit() throws java.io.IOException
java.io.IOException
public IndexWriter.DocStats getDocStats()
public long deleteAll() throws java.io.IOException
java.io.IOException
public DirectoryReader getReader() throws java.io.IOException
java.io.IOException
public void forceMergeDeletes(boolean doWait) throws java.io.IOException
java.io.IOException
public void forceMergeDeletes() throws java.io.IOException
java.io.IOException
public void setDoRandomForceMerge(boolean v)
public void setDoRandomForceMergeAssert(boolean v)
public DirectoryReader getReader(boolean applyDeletions, boolean writeAllDeletes) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
IndexWriter.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.IOException
IndexWriter.forceMerge(int)
public final void flush() throws java.io.IOException
Directory
.java.io.IOException
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.