Class IndexWriterConfig
Holds all the configuration that is used to create an Index
LUCENENET NOTE: Unlike Lucene, we use property setters instead of setter methods.
In C#, this allows you to initialize the Index
IndexWriterConfig conf = new IndexWriterConfig(analyzer)
{
Codec = Lucene46Codec(),
OpenMode = OpenMode.CREATE
};
However, if you prefer to match the syntax of Lucene using chained setter methods, there are extension methods in the Lucene.Net.Support namespace. Example usage:
using Lucene.Net.Support;
..
IndexWriterConfig conf = new IndexWriterConfig(analyzer)
.SetCodec(new Lucene46Codec())
.SetOpenMode(OpenMode.CREATE);
@since 3.1
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class IndexWriterConfig : LiveIndexWriterConfig
Constructors
| Improve this Doc View SourceIndexWriterConfig(LuceneVersion, Analyzer)
Creates a new config that with defaults that match the specified
LucenematchVersion
is >=
LUCENE_32, Tiered
Declaration
public IndexWriterConfig(LuceneVersion matchVersion, Analyzer analyzer)
Parameters
Type | Name | Description |
---|---|---|
Lucene |
matchVersion | |
Analyzer | analyzer |
Fields
| Improve this Doc View SourceDEFAULT_CHECK_INTEGRITY_AT_MERGE
Default value for calling Checkfalse
). You can set this
to true
for additional safety.
Declaration
public static readonly bool DEFAULT_CHECK_INTEGRITY_AT_MERGE
Field Value
Type | Description |
---|---|
System. |
DEFAULT_MAX_BUFFERED_DELETE_TERMS
Disabled by default (because IndexWriter flushes by RAM usage by default).
Declaration
public static readonly int DEFAULT_MAX_BUFFERED_DELETE_TERMS
Field Value
Type | Description |
---|---|
System. |
DEFAULT_MAX_BUFFERED_DOCS
Disabled by default (because IndexWriter flushes by RAM usage by default).
Declaration
public static readonly int DEFAULT_MAX_BUFFERED_DOCS
Field Value
Type | Description |
---|---|
System. |
DEFAULT_MAX_THREAD_STATES
The maximum number of simultaneous threads that may be
indexing documents at once in Index
Declaration
public static readonly int DEFAULT_MAX_THREAD_STATES
Field Value
Type | Description |
---|---|
System. |
DEFAULT_RAM_BUFFER_SIZE_MB
Default value is 16 MB (which means flush when buffered docs consume approximately 16 MB RAM).
Declaration
public static readonly double DEFAULT_RAM_BUFFER_SIZE_MB
Field Value
Type | Description |
---|---|
System. |
DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB
Default value is 1945. Change using RAMPer
Declaration
public static readonly int DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB
Field Value
Type | Description |
---|---|
System. |
DEFAULT_READER_POOLING
Default setting for Use
Declaration
public static readonly bool DEFAULT_READER_POOLING
Field Value
Type | Description |
---|---|
System. |
DEFAULT_READER_TERMS_INDEX_DIVISOR
Default value is 1. Change using Reader
Declaration
public static readonly int DEFAULT_READER_TERMS_INDEX_DIVISOR
Field Value
Type | Description |
---|---|
System. |
DEFAULT_TERM_INDEX_INTERVAL
Default value is 32. Change using Term
Declaration
public static readonly int DEFAULT_TERM_INDEX_INTERVAL
Field Value
Type | Description |
---|---|
System. |
DEFAULT_USE_COMPOUND_FILE_SYSTEM
Default value for compound file system for newly written segments
(set to true
). For batch indexing with very large
ram buffers use false
Declaration
public static readonly bool DEFAULT_USE_COMPOUND_FILE_SYSTEM
Field Value
Type | Description |
---|---|
System. |
DISABLE_AUTO_FLUSH
Denotes a flush trigger is disabled.
Declaration
public static readonly int DISABLE_AUTO_FLUSH
Field Value
Type | Description |
---|---|
System. |
WRITE_LOCK_TIMEOUT
Default value for the write lock timeout (1,000 ms).
Declaration
public static long WRITE_LOCK_TIMEOUT
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceCodec
Gets or sets the Codec.
Only takes effect when Index
Declaration
public Codec Codec { get; set; }
Property Value
Type | Description |
---|---|
Codec |
DefaultWriteLockTimeout
Gets or sets the default (for any instance) maximum time to wait for a write lock (in milliseconds).
Declaration
public static long DefaultWriteLockTimeout { get; set; }
Property Value
Type | Description |
---|---|
System. |
IndexCommit
Expert: allows to open a certain commit point. The default is null
which
opens the latest commit point.
Only takes effect when Index
Declaration
public IndexCommit IndexCommit { get; set; }
Property Value
Type | Description |
---|---|
Index |
IndexDeletionPolicy
Expert: allows an optional Index
NOTE: the deletion policy cannot be null
.
Only takes effect when IndexWriter is first created.
Declaration
public IndexDeletionPolicy IndexDeletionPolicy { get; set; }
Property Value
Type | Description |
---|---|
Index |
MaxThreadStates
Gets or sets the max number of simultaneous threads that may be indexing documents
at once in IndexmaxThreadStates
will be set to
DEFAULT_MAX_THREAD_STATES.
Only takes effect when Index
Declaration
public int MaxThreadStates { get; set; }
Property Value
Type | Description |
---|---|
System. |
MergePolicy
Expert: Merge
Only takes effect when Index
Declaration
public MergePolicy MergePolicy { get; set; }
Property Value
Type | Description |
---|---|
Merge |
MergeScheduler
Expert: Gets or sets the merge scheduler used by this writer. The default is
Concurrent
NOTE: the merge scheduler cannot be null
.
Only takes effect when Index
Declaration
public IMergeScheduler MergeScheduler { get; set; }
Property Value
Type | Description |
---|---|
IMerge |
OpenMode
Specifies Open
Only takes effect when Index
Declaration
public OpenMode OpenMode { get; set; }
Property Value
Type | Description |
---|---|
Open |
RAMPerThreadHardLimitMB
Expert: Gets or sets the maximum memory consumption per thread triggering a forced
flush if exceeded. A Lucene.
Declaration
public int RAMPerThreadHardLimitMB { get; set; }
Property Value
Type | Description |
---|---|
System. |
See Also
| Improve this Doc View SourceSimilarity
Expert: set the Similarity implementation used by this Index
NOTE: the similarity cannot be null
.
Only takes effect when Index
Declaration
public Similarity Similarity { get; set; }
Property Value
Type | Description |
---|---|
Similarity |
UseReaderPooling
By default, Indexfalse
, Index
Only takes effect when Index
Declaration
public bool UseReaderPooling { get; set; }
Property Value
Type | Description |
---|---|
System. |
WriteLockTimeout
Gets or 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 the
Default
Only takes effect when Index
Declaration
public long WriteLockTimeout { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceClone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System. |
SetInfoStream(InfoStream)
Information about merges, deletes and a
message when maxFieldLength is reached will be printed
to this. Must not be null
, but NO_OUTPUT
may be used to supress output.
Declaration
public IndexWriterConfig SetInfoStream(InfoStream infoStream)
Parameters
Type | Name | Description |
---|---|---|
Info |
infoStream |
Returns
Type | Description |
---|---|
Index |
SetInfoStream(TextWriter)
Convenience method that uses Textnull
.
Declaration
public IndexWriterConfig SetInfoStream(TextWriter printStream)
Parameters
Type | Name | Description |
---|---|---|
Text |
printStream |
Returns
Type | Description |
---|---|
Index |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |