Class RandomIndexWriter
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Implements
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.TestFramework.dll
Syntax
public class RandomIndexWriter : IDisposable
  Constructors
RandomIndexWriter(Random, Directory)
Create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer.
Declaration
public RandomIndexWriter(Random r, Directory dir)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Random | r | |
| Directory | dir | 
RandomIndexWriter(Random, Directory, Analyzer)
Create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT.
Declaration
public RandomIndexWriter(Random r, Directory dir, Analyzer a)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Random | r | |
| Directory | dir | |
| Analyzer | a | 
RandomIndexWriter(Random, Directory, IndexWriterConfig)
Creates a RandomIndexWriter with the provided config
Declaration
public RandomIndexWriter(Random r, Directory dir, IndexWriterConfig c)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Random | r | |
| Directory | dir | |
| IndexWriterConfig | c | 
RandomIndexWriter(Random, Directory, LuceneVersion, Analyzer)
Creates a RandomIndexWriter with a random config.
Declaration
public RandomIndexWriter(Random r, Directory dir, LuceneVersion v, Analyzer a)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Random | r | |
| Directory | dir | |
| LuceneVersion | v | |
| Analyzer | a | 
Properties
DoRandomForceMerge
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual bool DoRandomForceMerge { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
DoRandomForceMergeAssert
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual bool DoRandomForceMergeAssert { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
IndexWriter
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public IndexWriter IndexWriter { get; set; }
  Property Value
| Type | Description | 
|---|---|
| IndexWriter | 
MaxDoc
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual int MaxDoc { get; }
  Property Value
| Type | Description | 
|---|---|
| int | 
NumDocs
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual int NumDocs { get; }
  Property Value
| Type | Description | 
|---|---|
| int | 
Methods
AddDocument(IEnumerable<IIndexableField>)
Adds a Document.
Declaration
public virtual void AddDocument(IEnumerable<IIndexableField> doc)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<IIndexableField> | doc | 
See Also
AddDocument(IEnumerable<IIndexableField>, Analyzer)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void AddDocument(IEnumerable<IIndexableField> doc, Analyzer a)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<IIndexableField> | doc | |
| Analyzer | a | 
AddDocuments(IEnumerable<IEnumerable<IIndexableField>>)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void AddDocuments(IEnumerable<IEnumerable<IIndexableField>> docs)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<IEnumerable<IIndexableField>> | docs | 
AddIndexes(params IndexReader[])
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void AddIndexes(params IndexReader[] readers)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IndexReader[] | readers | 
AddIndexes(params Directory[])
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void AddIndexes(params Directory[] dirs)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Directory[] | dirs | 
Commit()
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void Commit()
  DeleteAll()
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void DeleteAll()
  DeleteDocuments(Term)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void DeleteDocuments(Term term)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Term | term | 
DeleteDocuments(Query)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void DeleteDocuments(Query q)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Query | q | 
Dispose()
Dispose this writer.
Declaration
public void Dispose()
  See Also
Dispose(bool)
Dispose this writer.
Declaration
protected virtual void Dispose(bool disposing)
  Parameters
| Type | Name | Description | 
|---|---|---|
| bool | disposing | 
See Also
ForceMerge(int)
Forces a forceMerge.
NOTE: this should be avoided in tests unless absolutely necessary, as it will result in less test coverage.Declaration
public virtual void ForceMerge(int maxSegmentCount)
  Parameters
| Type | Name | Description | 
|---|---|---|
| int | maxSegmentCount | 
See Also
ForceMergeDeletes()
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void ForceMergeDeletes()
  ForceMergeDeletes(bool)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void ForceMergeDeletes(bool doWait)
  Parameters
| Type | Name | Description | 
|---|---|---|
| bool | doWait | 
GetReader()
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual DirectoryReader GetReader()
  Returns
| Type | Description | 
|---|---|
| DirectoryReader | 
GetReader(bool)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual DirectoryReader GetReader(bool applyDeletions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| bool | applyDeletions | 
Returns
| Type | Description | 
|---|---|
| DirectoryReader | 
MockIndexWriter(Directory, IndexWriterConfig, ITestPoint)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public static IndexWriter MockIndexWriter(Directory dir, IndexWriterConfig conf, ITestPoint testPoint)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Directory | dir | |
| IndexWriterConfig | conf | |
| ITestPoint | testPoint | 
Returns
| Type | Description | 
|---|---|
| IndexWriter | 
MockIndexWriter(Directory, IndexWriterConfig, Random)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public static IndexWriter MockIndexWriter(Directory dir, IndexWriterConfig conf, Random r)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Directory | dir | |
| IndexWriterConfig | conf | |
| Random | r | 
Returns
| Type | Description | 
|---|---|
| IndexWriter | 
UpdateBinaryDocValue(Term, string, BytesRef)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void UpdateBinaryDocValue(Term term, string field, BytesRef value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Term | term | |
| string | field | |
| BytesRef | value | 
UpdateDocument(Term, IEnumerable<IIndexableField>)
Updates a document.
Declaration
public virtual void UpdateDocument(Term t, IEnumerable<IIndexableField> doc)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Term | t | |
| IEnumerable<IIndexableField> | doc | 
UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void UpdateDocuments(Term delTerm, IEnumerable<IEnumerable<IIndexableField>> docs)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Term | delTerm | |
| IEnumerable<IEnumerable<IIndexableField>> | docs | 
UpdateNumericDocValue(Term, string, long?)
Silly class that randomizes the indexing experience. EG it may swap in a different merge policy/scheduler; may commit periodically; may or may not forceMerge in the end, may flush by doc count instead of RAM, etc.
Declaration
public virtual void UpdateNumericDocValue(Term term, string field, long? value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Term | term | |
| string | field | |
| long? | value |