Lucene.Net 1.9.1 Class Library

IndexWriter Members

IndexWriter overview

Public Static Fields

COMMIT_LOCK_NAME 
COMMIT_LOCK_TIMEOUT Default value is 10,000.
DEFAULT_MAX_BUFFERED_DOCS Default value is 10. Change using {@link #SetMaxBufferedDocs(int)}.
DEFAULT_MAX_FIELD_LENGTH Default value is 10,000. Change using {@link #SetMaxFieldLength(int)}.
DEFAULT_MAX_MERGE_DOCS Default value is {@link Integer#MAX_VALUE}. Change using {@link #SetMaxMergeDocs(int)}.
DEFAULT_MERGE_FACTOR Default value is 10. Change using {@link #SetMergeFactor(int)}.
DEFAULT_MIN_MERGE_DOCS 
DEFAULT_TERM_INDEX_INTERVAL Default value is 128. Change using {@link #SetTermIndexInterval(int)}.
WRITE_LOCK_NAME 
WRITE_LOCK_TIMEOUT Default value is 1,000.

Public Instance Constructors

IndexWriter Overloaded. Initializes a new instance of the IndexWriter class.

Public Instance Fields

infoStreamIf non-null, information about merges will be printed to this.
maxFieldLength The maximum number of terms that will be indexed for a single field in a document. This limits the amount of memory required for indexing, so that collections with very large files will not crash the indexing process by running out of memory. Note that this effectively truncates large documents, excluding from the index terms that occur further in the document. If you know your source documents are large, be sure to set this value high enough to accomodate the expected size. If you set it to Integer.MAX_VALUE, then the only limit is your memory, but you should anticipate an OutOfMemoryError. By default, no more than 10,000 terms will be indexed for a field.
maxMergeDocs 
mergeFactor 
minMergeDocs 

Public Instance Methods

AddDocumentOverloaded. Adds a document to this index, using the provided analyzer instead of the value of {@link #GetAnalyzer()}. If the document contains more than {@link #SetMaxFieldLength(int)} terms for a given field, the remainder are discarded.
AddIndexesOverloaded. Merges the provided indexes into this index. After this completes, the index is optimized. The provided IndexReaders are not closed.
CloseFlushes all changes to an index and closes all associated files.
DocCountReturns the number of documents currently in this index.
Equals (inherited from Object) Determines whether the specified Object is equal to the current Object.
GetAnalyzerReturns the analyzer used by this index.
GetDirectoryReturns the Directory used by this index.
GetHashCode (inherited from Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetInfoStream 
GetMaxBufferedDocs 
GetMaxFieldLength 
GetMaxMergeDocs 
GetMergeFactor 
GetSimilarity 
GetTermIndexIntervalExpert: Return the interval between indexed terms.
GetType (inherited from Object) Gets the Type of the current instance.
GetUseCompoundFileGet the current setting of whether to use the compound file format. Note that this just returns the value you set with setUseCompoundFile(boolean) or the default. You cannot use this to query the status of an existing index.
OptimizeMerges all segments together into a single segment, optimizing an index for search.
SetInfoStreamIf non-null, information about merges and a message when maxFieldLength is reached will be printed to this.
SetMaxBufferedDocs 
SetMaxFieldLength The maximum number of terms that will be indexed for a single field in a document. This limits the amount of memory required for indexing, so that collections with very large files will not crash the indexing process by running out of memory. Note that this effectively truncates large documents, excluding from the index terms that occur further in the document. If you know your source documents are large, be sure to set this value high enough to accomodate the expected size. If you set it to Integer.MAX_VALUE, then the only limit is your memory, but you should anticipate an OutOfMemoryError. By default, no more than 10,000 terms will be indexed for a field.
SetMaxMergeDocs 
SetMergeFactor 
SetSimilarityExpert: Set the Similarity implementation used by this IndexWriter.
SetTermIndexIntervalExpert: Set the interval between indexed terms. Large values cause less memory to be used by IndexReader, but slow random-access to terms. Small values cause more memory to be used by an IndexReader, and speed random-access to terms. This parameter determines the amount of computation required per query term, regardless of the number of documents that contain that term. In particular, it is the maximum number of other terms that must be scanned before a term is located and its frequency and position information may be processed. In a large index with user-entered query terms, query processing time is likely to be dominated not by term lookup but rather by the processing of frequency and positional data. In a small index or when many uncommon query terms are generated (e.g., by wildcard queries) term lookup may become a dominant cost. In particular,
numUniqueTerms/interval
terms are read into memory by an IndexReader, and, on average,
interval/2
terms must be scanned for each random term access.
SetUseCompoundFileSetting to turn on usage of a compound file. When on, multiple files for each segment are merged into a single file once the segment creation is finished. This is done regardless of what directory is in use.
ToString (inherited from Object) Returns a String that represents the current Object.

Protected Instance Methods

FinalizeRelease the write lock, if needed.
MemberwiseClone (inherited from Object) Creates a shallow copy of the current Object.

See Also

IndexWriter Class | Lucene.Net.Index Namespace