C# Class Lucene.Net.Index.IndexWriterConfig

Holds all the configuration that is used to create an IndexWriter. Once IndexWriter has been created with this object, changes to this object will not affect the IndexWriter instance. For that, use LiveIndexWriterConfig that is returned from IndexWriter#getConfig().

All setter methods return IndexWriterConfig to allow chaining settings conveniently, for example:

 IndexWriterConfig conf = new IndexWriterConfig(analyzer); conf.setter1().setter2(); 
Inheritance: LiveIndexWriterConfig, ICloneable
Datei anzeigen Open project: paulirwin/lucene.net Class Usage Examples

Public Properties

Property Type Description
WRITE_LOCK_TIMEOUT long

Public Methods

Method Description
Clone ( ) : object
IndexWriterConfig ( Version matchVersion, Analyzer analyzer ) : System

Creates a new config that with defaults that match the specified Version as well as the default {@link Analyzer}. If matchVersion is >= {@link Version#LUCENE_32}, TieredMergePolicy is used for merging; else LogByteSizeMergePolicy. Note that TieredMergePolicy is free to select non-contiguous merges, which means docIDs may not remain monotonic over time. If this is a problem you should switch to LogByteSizeMergePolicy or LogDocMergePolicy.

SetCodec ( System.Codec codec ) : IndexWriterConfig

Set the Codec.

Only takes effect when IndexWriter is first created.

SetFlushPolicy ( Lucene.Net.Index.FlushPolicy flushPolicy ) : IndexWriterConfig

Expert: Controls when segments are flushed to disk during indexing. The FlushPolicy initialized during IndexWriter instantiation and once initialized the given instance is bound to this IndexWriter and should not be used with another writer.

SetIndexCommit ( IndexCommit commit ) : IndexWriterConfig

Expert: allows to open a certain commit point. The default is null which opens the latest commit point.

Only takes effect when IndexWriter is first created.

SetIndexDeletionPolicy ( IndexDeletionPolicy deletionPolicy ) : IndexWriterConfig

Expert: allows an optional IndexDeletionPolicy implementation to be specified. You can use this to control when prior commits are deleted from the index. The default policy is KeepOnlyLastCommitDeletionPolicy which removes all prior commits as soon as a new commit is done (this matches behavior before 2.2). Creating your own policy can allow you to explicitly keep previous "point in time" commits alive in the index for some time, to allow readers to refresh to the new commit without having the old commit deleted out from under them. this is necessary on filesystems like NFS that do not support "delete on last close" semantics, which Lucene's "point in time" search normally relies on.

NOTE: the deletion policy cannot be null.

Only takes effect when IndexWriter is first created.

SetIndexerThreadPool ( Lucene.Net.Index.DocumentsWriterPerThreadPool threadPool ) : IndexWriterConfig

Expert: Sets the DocumentsWriterPerThreadPool instance used by the IndexWriter to assign thread-states to incoming indexing threads. If no DocumentsWriterPerThreadPool is set IndexWriter will use ThreadAffinityDocumentsWriterThreadPool with max number of thread-states set to #DEFAULT_MAX_THREAD_STATES (see #DEFAULT_MAX_THREAD_STATES).

NOTE: The given DocumentsWriterPerThreadPool instance must not be used with other IndexWriter instances once it has been initialized / associated with an IndexWriter.

NOTE: this only takes effect when IndexWriter is first created.

SetIndexingChain ( IndexingChain indexingChain ) : IndexWriterConfig

Expert: sets the DocConsumer chain to be used to process documents.

Only takes effect when IndexWriter is first created.

SetInfoStream ( Lucene.Net.Util.InfoStream infoStream ) : IndexWriterConfig

Information about merges, deletes and a message when maxFieldLength is reached will be printed to this. Must not be null, but InfoStream#NO_OUTPUT may be used to supress output.

SetInfoStream ( TextWriter printStream ) : IndexWriterConfig

Convenience method that uses PrintStreamInfoStream. Must not be null.

SetMaxBufferedDeleteTerms ( int maxBufferedDeleteTerms ) : IndexWriterConfig
SetMaxBufferedDocs ( int maxBufferedDocs ) : IndexWriterConfig
SetMaxThreadStates ( int maxThreadStates ) : IndexWriterConfig

Sets the max number of simultaneous threads that may be indexing documents at once in IndexWriter. Values < 1 are invalid and if passed maxThreadStates will be set to #DEFAULT_MAX_THREAD_STATES.

Only takes effect when IndexWriter is first created.

SetMergePolicy ( MergePolicy mergePolicy ) : IndexWriterConfig

Expert: MergePolicy is invoked whenever there are changes to the segments in the index. Its role is to select which merges to do, if any, and return a MergePolicy.MergeSpecification describing the merges. It also selects merges to do for forceMerge.

Only takes effect when IndexWriter is first created.

SetMergeScheduler ( Lucene.Net.Index.MergeScheduler mergeScheduler ) : IndexWriterConfig

Expert: sets the merge scheduler used by this writer. The default is ConcurrentMergeScheduler.

NOTE: the merge scheduler cannot be null.

Only takes effect when IndexWriter is first created.

SetMergedSegmentWarmer ( IndexReaderWarmer mergeSegmentWarmer ) : IndexWriterConfig
SetOpenMode ( OpenMode_e openMode ) : IndexWriterConfig

Specifies OpenMode of the index.

Only takes effect when IndexWriter is first created.

SetRAMBufferSizeMB ( double ramBufferSizeMB ) : IndexWriterConfig
SetRAMPerThreadHardLimitMB ( int perThreadHardLimitMB ) : IndexWriterConfig

Expert: Sets the maximum memory consumption per thread triggering a forced flush if exceeded. A DocumentsWriterPerThread is forcefully flushed once it exceeds this limit even if the #getRAMBufferSizeMB() has not been exceeded. this is a safety limit to prevent a DocumentsWriterPerThread from address space exhaustion due to its internal 32 bit signed integer based memory addressing. The given value must be less that 2GB (2048MB)

SetReaderPooling ( bool readerPooling ) : IndexWriterConfig

By default, IndexWriter does not pool the SegmentReaders it must open for deletions and merging, unless a near-real-time reader has been obtained by calling DirectoryReader#open(IndexWriter, boolean). this method lets you enable pooling without getting a near-real-time reader. NOTE: if you set this to false, IndexWriter will still pool readers once DirectoryReader#open(IndexWriter, boolean) is called.

Only takes effect when IndexWriter is first created.

SetReaderTermsIndexDivisor ( int divisor ) : IndexWriterConfig
SetSimilarity ( Similarity similarity ) : IndexWriterConfig

Expert: set the Similarity implementation used by this IndexWriter.

NOTE: the similarity cannot be null.

Only takes effect when IndexWriter is first created.

SetTermIndexInterval ( int interval ) : IndexWriterConfig
SetUseCompoundFile ( bool useCompoundFile ) : IndexWriterConfig
SetWriteLockTimeout ( long writeLockTimeout ) : IndexWriterConfig

Sets the maximum time to wait for a write lock (in milliseconds) for this instance. You can change the default value for all instances by calling #setDefaultWriteLockTimeout(long).

Only takes effect when IndexWriter is first created.

ToString ( ) : string

Private Methods

Method Description
SetIndexWriter ( IndexWriter writer ) : IndexWriterConfig

Sets the IndexWriter this config is attached to.

Method Details

Clone() public method

public Clone ( ) : object
return object

IndexWriterConfig() public method

Creates a new config that with defaults that match the specified Version as well as the default {@link Analyzer}. If matchVersion is >= {@link Version#LUCENE_32}, TieredMergePolicy is used for merging; else LogByteSizeMergePolicy. Note that TieredMergePolicy is free to select non-contiguous merges, which means docIDs may not remain monotonic over time. If this is a problem you should switch to LogByteSizeMergePolicy or LogDocMergePolicy.
public IndexWriterConfig ( Version matchVersion, Analyzer analyzer ) : System
matchVersion Version
analyzer Analyzer
return System

SetCodec() public method

Set the Codec.

Only takes effect when IndexWriter is first created.

public SetCodec ( System.Codec codec ) : IndexWriterConfig
codec System.Codec
return IndexWriterConfig

SetFlushPolicy() public method

Expert: Controls when segments are flushed to disk during indexing. The FlushPolicy initialized during IndexWriter instantiation and once initialized the given instance is bound to this IndexWriter and should not be used with another writer.
public SetFlushPolicy ( Lucene.Net.Index.FlushPolicy flushPolicy ) : IndexWriterConfig
flushPolicy Lucene.Net.Index.FlushPolicy
return IndexWriterConfig

SetIndexCommit() public method

Expert: allows to open a certain commit point. The default is null which opens the latest commit point.

Only takes effect when IndexWriter is first created.

public SetIndexCommit ( IndexCommit commit ) : IndexWriterConfig
commit IndexCommit
return IndexWriterConfig

SetIndexDeletionPolicy() public method

Expert: allows an optional IndexDeletionPolicy implementation to be specified. You can use this to control when prior commits are deleted from the index. The default policy is KeepOnlyLastCommitDeletionPolicy which removes all prior commits as soon as a new commit is done (this matches behavior before 2.2). Creating your own policy can allow you to explicitly keep previous "point in time" commits alive in the index for some time, to allow readers to refresh to the new commit without having the old commit deleted out from under them. this is necessary on filesystems like NFS that do not support "delete on last close" semantics, which Lucene's "point in time" search normally relies on.

NOTE: the deletion policy cannot be null.

Only takes effect when IndexWriter is first created.

public SetIndexDeletionPolicy ( IndexDeletionPolicy deletionPolicy ) : IndexWriterConfig
deletionPolicy IndexDeletionPolicy
return IndexWriterConfig

SetIndexerThreadPool() public method

Expert: Sets the DocumentsWriterPerThreadPool instance used by the IndexWriter to assign thread-states to incoming indexing threads. If no DocumentsWriterPerThreadPool is set IndexWriter will use ThreadAffinityDocumentsWriterThreadPool with max number of thread-states set to #DEFAULT_MAX_THREAD_STATES (see #DEFAULT_MAX_THREAD_STATES).

NOTE: The given DocumentsWriterPerThreadPool instance must not be used with other IndexWriter instances once it has been initialized / associated with an IndexWriter.

NOTE: this only takes effect when IndexWriter is first created.

public SetIndexerThreadPool ( Lucene.Net.Index.DocumentsWriterPerThreadPool threadPool ) : IndexWriterConfig
threadPool Lucene.Net.Index.DocumentsWriterPerThreadPool
return IndexWriterConfig

SetIndexingChain() public method

Expert: sets the DocConsumer chain to be used to process documents.

Only takes effect when IndexWriter is first created.

public SetIndexingChain ( IndexingChain indexingChain ) : IndexWriterConfig
indexingChain IndexingChain
return IndexWriterConfig

SetInfoStream() public method

Information about merges, deletes and a message when maxFieldLength is reached will be printed to this. Must not be null, but InfoStream#NO_OUTPUT may be used to supress output.
public SetInfoStream ( Lucene.Net.Util.InfoStream infoStream ) : IndexWriterConfig
infoStream Lucene.Net.Util.InfoStream
return IndexWriterConfig

SetInfoStream() public method

Convenience method that uses PrintStreamInfoStream. Must not be null.
public SetInfoStream ( TextWriter printStream ) : IndexWriterConfig
printStream System.IO.TextWriter
return IndexWriterConfig

SetMaxBufferedDeleteTerms() public method

public SetMaxBufferedDeleteTerms ( int maxBufferedDeleteTerms ) : IndexWriterConfig
maxBufferedDeleteTerms int
return IndexWriterConfig

SetMaxBufferedDocs() public method

public SetMaxBufferedDocs ( int maxBufferedDocs ) : IndexWriterConfig
maxBufferedDocs int
return IndexWriterConfig

SetMaxThreadStates() public method

Sets the max number of simultaneous threads that may be indexing documents at once in IndexWriter. Values < 1 are invalid and if passed maxThreadStates will be set to #DEFAULT_MAX_THREAD_STATES.

Only takes effect when IndexWriter is first created.

public SetMaxThreadStates ( int maxThreadStates ) : IndexWriterConfig
maxThreadStates int
return IndexWriterConfig

SetMergePolicy() public method

Expert: MergePolicy is invoked whenever there are changes to the segments in the index. Its role is to select which merges to do, if any, and return a MergePolicy.MergeSpecification describing the merges. It also selects merges to do for forceMerge.

Only takes effect when IndexWriter is first created.

public SetMergePolicy ( MergePolicy mergePolicy ) : IndexWriterConfig
mergePolicy MergePolicy
return IndexWriterConfig

SetMergeScheduler() public method

Expert: sets the merge scheduler used by this writer. The default is ConcurrentMergeScheduler.

NOTE: the merge scheduler cannot be null.

Only takes effect when IndexWriter is first created.

public SetMergeScheduler ( Lucene.Net.Index.MergeScheduler mergeScheduler ) : IndexWriterConfig
mergeScheduler Lucene.Net.Index.MergeScheduler
return IndexWriterConfig

SetMergedSegmentWarmer() public method

public SetMergedSegmentWarmer ( IndexReaderWarmer mergeSegmentWarmer ) : IndexWriterConfig
mergeSegmentWarmer IndexReaderWarmer
return IndexWriterConfig

SetOpenMode() public method

Specifies OpenMode of the index.

Only takes effect when IndexWriter is first created.

public SetOpenMode ( OpenMode_e openMode ) : IndexWriterConfig
openMode OpenMode_e
return IndexWriterConfig

SetRAMBufferSizeMB() public method

public SetRAMBufferSizeMB ( double ramBufferSizeMB ) : IndexWriterConfig
ramBufferSizeMB double
return IndexWriterConfig

SetRAMPerThreadHardLimitMB() public method

Expert: Sets the maximum memory consumption per thread triggering a forced flush if exceeded. A DocumentsWriterPerThread is forcefully flushed once it exceeds this limit even if the #getRAMBufferSizeMB() has not been exceeded. this is a safety limit to prevent a DocumentsWriterPerThread from address space exhaustion due to its internal 32 bit signed integer based memory addressing. The given value must be less that 2GB (2048MB)
public SetRAMPerThreadHardLimitMB ( int perThreadHardLimitMB ) : IndexWriterConfig
perThreadHardLimitMB int
return IndexWriterConfig

SetReaderPooling() public method

By default, IndexWriter does not pool the SegmentReaders it must open for deletions and merging, unless a near-real-time reader has been obtained by calling DirectoryReader#open(IndexWriter, boolean). this method lets you enable pooling without getting a near-real-time reader. NOTE: if you set this to false, IndexWriter will still pool readers once DirectoryReader#open(IndexWriter, boolean) is called.

Only takes effect when IndexWriter is first created.

public SetReaderPooling ( bool readerPooling ) : IndexWriterConfig
readerPooling bool
return IndexWriterConfig

SetReaderTermsIndexDivisor() public method

public SetReaderTermsIndexDivisor ( int divisor ) : IndexWriterConfig
divisor int
return IndexWriterConfig

SetSimilarity() public method

Expert: set the Similarity implementation used by this IndexWriter.

NOTE: the similarity cannot be null.

Only takes effect when IndexWriter is first created.

public SetSimilarity ( Similarity similarity ) : IndexWriterConfig
similarity Similarity
return IndexWriterConfig

SetTermIndexInterval() public method

public SetTermIndexInterval ( int interval ) : IndexWriterConfig
interval int
return IndexWriterConfig

SetUseCompoundFile() public method

public SetUseCompoundFile ( bool useCompoundFile ) : IndexWriterConfig
useCompoundFile bool
return IndexWriterConfig

SetWriteLockTimeout() public method

Sets the maximum time to wait for a write lock (in milliseconds) for this instance. You can change the default value for all instances by calling #setDefaultWriteLockTimeout(long).

Only takes effect when IndexWriter is first created.

public SetWriteLockTimeout ( long writeLockTimeout ) : IndexWriterConfig
writeLockTimeout long
return IndexWriterConfig

ToString() public method

public ToString ( ) : string
return string

Property Details

WRITE_LOCK_TIMEOUT public_oe static_oe property

Default value for the write lock timeout (1,000 ms).
public static long WRITE_LOCK_TIMEOUT
return long