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
Afficher le fichier Open project: paulirwin/lucene.net Class Usage Examples

Méthodes publiques

Свойство Type Description
WRITE_LOCK_TIMEOUT long

Méthodes publiques

Méthode 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

Méthode Description
SetIndexWriter ( IndexWriter writer ) : IndexWriterConfig

Sets the IndexWriter this config is attached to.

Method Details

Clone() public méthode

public Clone ( ) : object
Résultat object

IndexWriterConfig() public méthode

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
Résultat System

SetCodec() public méthode

Set the Codec.

Only takes effect when IndexWriter is first created.

public SetCodec ( System.Codec codec ) : IndexWriterConfig
codec System.Codec
Résultat IndexWriterConfig

SetFlushPolicy() public méthode

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
Résultat IndexWriterConfig

SetIndexCommit() public méthode

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
Résultat IndexWriterConfig

SetIndexDeletionPolicy() public méthode

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
Résultat IndexWriterConfig

SetIndexerThreadPool() public méthode

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
Résultat IndexWriterConfig

SetIndexingChain() public méthode

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
Résultat IndexWriterConfig

SetInfoStream() public méthode

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
Résultat IndexWriterConfig

SetInfoStream() public méthode

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

SetMaxBufferedDeleteTerms() public méthode

public SetMaxBufferedDeleteTerms ( int maxBufferedDeleteTerms ) : IndexWriterConfig
maxBufferedDeleteTerms int
Résultat IndexWriterConfig

SetMaxBufferedDocs() public méthode

public SetMaxBufferedDocs ( int maxBufferedDocs ) : IndexWriterConfig
maxBufferedDocs int
Résultat IndexWriterConfig

SetMaxThreadStates() public méthode

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
Résultat IndexWriterConfig

SetMergePolicy() public méthode

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
Résultat IndexWriterConfig

SetMergeScheduler() public méthode

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
Résultat IndexWriterConfig

SetMergedSegmentWarmer() public méthode

public SetMergedSegmentWarmer ( IndexReaderWarmer mergeSegmentWarmer ) : IndexWriterConfig
mergeSegmentWarmer IndexReaderWarmer
Résultat IndexWriterConfig

SetOpenMode() public méthode

Specifies OpenMode of the index.

Only takes effect when IndexWriter is first created.

public SetOpenMode ( OpenMode_e openMode ) : IndexWriterConfig
openMode OpenMode_e
Résultat IndexWriterConfig

SetRAMBufferSizeMB() public méthode

public SetRAMBufferSizeMB ( double ramBufferSizeMB ) : IndexWriterConfig
ramBufferSizeMB double
Résultat IndexWriterConfig

SetRAMPerThreadHardLimitMB() public méthode

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
Résultat IndexWriterConfig

SetReaderPooling() public méthode

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
Résultat IndexWriterConfig

SetReaderTermsIndexDivisor() public méthode

public SetReaderTermsIndexDivisor ( int divisor ) : IndexWriterConfig
divisor int
Résultat IndexWriterConfig

SetSimilarity() public méthode

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
Résultat IndexWriterConfig

SetTermIndexInterval() public méthode

public SetTermIndexInterval ( int interval ) : IndexWriterConfig
interval int
Résultat IndexWriterConfig

SetUseCompoundFile() public méthode

public SetUseCompoundFile ( bool useCompoundFile ) : IndexWriterConfig
useCompoundFile bool
Résultat IndexWriterConfig

SetWriteLockTimeout() public méthode

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
Résultat IndexWriterConfig

ToString() public méthode

public ToString ( ) : string
Résultat 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
Résultat long