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.
 
  
  
    Inheritance
    System.Object
    RandomIndexWriter
   
  
    Implements
    System.IDisposable
   
  
    Inherited Members
    
      System.Object.Equals(System.Object)
    
    
      System.Object.Equals(System.Object, System.Object)
    
    
      System.Object.GetHashCode()
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
    
      System.Object.ToString()
    
   
  
  Assembly: Lucene.Net.TestFramework.dll
  Syntax
  
    public class RandomIndexWriter : IDisposable
   
  Constructors
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  RandomIndexWriter(Random, Directory)
  
  
  Declaration
  
    public RandomIndexWriter(Random r, Directory dir)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Random | 
        r | 
         | 
      
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  RandomIndexWriter(Random, Directory, Analyzer)
  
  
  Declaration
  
    public RandomIndexWriter(Random r, Directory dir, Analyzer a)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Random | 
        r | 
         | 
      
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
      
        | Lucene.Net.Analysis.Analyzer | 
        a | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  RandomIndexWriter(Random, Directory, IndexWriterConfig)
  
  
  Declaration
  
    public RandomIndexWriter(Random r, Directory dir, IndexWriterConfig c)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Random | 
        r | 
         | 
      
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
      
        | Lucene.Net.Index.IndexWriterConfig | 
        c | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  RandomIndexWriter(Random, Directory, LuceneVersion, Analyzer)
  
  
  Declaration
  
    public RandomIndexWriter(Random r, Directory dir, LuceneVersion v, Analyzer a)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Random | 
        r | 
         | 
      
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
      
        | Lucene.Net.Util.LuceneVersion | 
        v | 
         | 
      
      
        | Lucene.Net.Analysis.Analyzer | 
        a | 
         | 
      
    
  
  Properties
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DoRandomForceMerge
  
  
  Declaration
  
    public virtual bool DoRandomForceMerge { get; set; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DoRandomForceMergeAssert
  
  
  Declaration
  
    public virtual bool DoRandomForceMergeAssert { get; set; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  IndexWriter
  
  
  Declaration
  
    public IndexWriter IndexWriter { get; set; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.IndexWriter | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  MaxDoc
  
  
  Declaration
  
    public virtual int MaxDoc { get; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  NumDocs
  
  
  Declaration
  
    public virtual int NumDocs { get; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  Methods
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddDocument(IEnumerable<IIndexableField>)
  
  
  Declaration
  
    public virtual void AddDocument(IEnumerable<IIndexableField> doc)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField> | 
        doc | 
         | 
      
    
  
  See Also
  
      Lucene.Net.Index.IndexWriter.AddDocument(System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField>)
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddDocument(IEnumerable<IIndexableField>, Analyzer)
  
  
  Declaration
  
    public virtual void AddDocument(IEnumerable<IIndexableField> doc, Analyzer a)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField> | 
        doc | 
         | 
      
      
        | Lucene.Net.Analysis.Analyzer | 
        a | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddDocuments(IEnumerable<IEnumerable<IIndexableField>>)
  
  
  Declaration
  
    public virtual void AddDocuments(IEnumerable<IEnumerable<IIndexableField>> docs)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField>> | 
        docs | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddIndexes(IndexReader[])
  
  
  Declaration
  
    public virtual void AddIndexes(params IndexReader[] readers)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.IndexReader[] | 
        readers | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  AddIndexes(Directory[])
  
  
  Declaration
  
    public virtual void AddIndexes(params Directory[] dirs)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Store.Directory[] | 
        dirs | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Commit()
  
  
  Declaration
  
    public virtual void Commit()
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DeleteAll()
  
  
  Declaration
  
    public virtual void DeleteAll()
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DeleteDocuments(Term)
  
  
  Declaration
  
    public virtual void DeleteDocuments(Term term)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.Term | 
        term | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  DeleteDocuments(Query)
  
  
  Declaration
  
    public virtual void DeleteDocuments(Query q)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Search.Query | 
        q | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Dispose()
  
  
  Declaration
  
  See Also
  
      Lucene.Net.Index.IndexWriter.Dispose()
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Dispose(Boolean)
  
  
  Declaration
  
    protected virtual void Dispose(bool disposing)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Boolean | 
        disposing | 
         | 
      
    
  
  See Also
  
      Lucene.Net.Index.IndexWriter.Dispose(System.Boolean)
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ForceMerge(Int32)
  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 | 
      
    
    
      
        | System.Int32 | 
        maxSegmentCount | 
         | 
      
    
  
  See Also
  
      Lucene.Net.Index.IndexWriter.ForceMerge(System.Int32)
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ForceMergeDeletes()
  
  
  Declaration
  
    public virtual void ForceMergeDeletes()
   
  
    |
    Improve this Doc
  
  
    View Source
  
  
  ForceMergeDeletes(Boolean)
  
  
  Declaration
  
    public virtual void ForceMergeDeletes(bool doWait)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Boolean | 
        doWait | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetReader()
  
  
  Declaration
  
    public virtual DirectoryReader GetReader()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.DirectoryReader | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetReader(Boolean)
  
  
  Declaration
  
    public virtual DirectoryReader GetReader(bool applyDeletions)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Boolean | 
        applyDeletions | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.DirectoryReader | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  MockIndexWriter(Directory, IndexWriterConfig, ITestPoint)
  
  
  Declaration
  
    public static IndexWriter MockIndexWriter(Directory dir, IndexWriterConfig conf, ITestPoint testPoint)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
      
        | Lucene.Net.Index.IndexWriterConfig | 
        conf | 
         | 
      
      
        | ITestPoint | 
        testPoint | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.IndexWriter | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  MockIndexWriter(Directory, IndexWriterConfig, Random)
  
  
  Declaration
  
    public static IndexWriter MockIndexWriter(Directory dir, IndexWriterConfig conf, Random r)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Store.Directory | 
        dir | 
         | 
      
      
        | Lucene.Net.Index.IndexWriterConfig | 
        conf | 
         | 
      
      
        | System.Random | 
        r | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.IndexWriter | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UpdateBinaryDocValue(Term, String, BytesRef)
  
  
  Declaration
  
    public virtual void UpdateBinaryDocValue(Term term, string field, BytesRef value)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.Term | 
        term | 
         | 
      
      
        | System.String | 
        field | 
         | 
      
      
        | Lucene.Net.Util.BytesRef | 
        value | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UpdateDocument(Term, IEnumerable<IIndexableField>)
  
  
  Declaration
  
    public virtual void UpdateDocument(Term t, IEnumerable<IIndexableField> doc)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.Term | 
        t | 
         | 
      
      
        | System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField> | 
        doc | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>)
  
  
  Declaration
  
    public virtual void UpdateDocuments(Term delTerm, IEnumerable<IEnumerable<IIndexableField>> docs)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.Term | 
        delTerm | 
         | 
      
      
        | System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<Lucene.Net.Index.IIndexableField>> | 
        docs | 
         | 
      
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  UpdateNumericDocValue(Term, String, Nullable<Int64>)
  
  
  Declaration
  
    public virtual void UpdateNumericDocValue(Term term, string field, long? value)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Lucene.Net.Index.Term | 
        term | 
         | 
      
      
        | System.String | 
        field | 
         | 
      
      
        | System.Nullable<System.Int64> | 
        value | 
         | 
      
    
  
  Implements
  
      System.IDisposable