Apache Lucene.Net 2.1 Class Library API

IndexWriter Members

IndexWriter overview

Public Static Fields

DEFAULT_MAX_BUFFERED_DELETE_TERMS Default value is 1000. Change using {@link #SetMaxBufferedDeleteTerms(int)}.
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_TERM_INDEX_INTERVAL Default value is 128. Change using {@link #SetTermIndexInterval(int)}.
WRITE_LOCK_NAME 
WRITE_LOCK_TIMEOUT Default value for the write lock timeout (1,000).

Public Static Methods

GetDefaultWriteLockTimeout 
SetDefaultWriteLockTimeout Sets the default (for any instance of IndexWriter) maximum time to wait for a write lock (in milliseconds).

Public Instance Constructors

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

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. See {@link #AddDocument(Document)} for details on index and IndexWriter state after an Exception, and flushing/merging temporary free space requirements.
AddIndexesOverloaded. Merges the provided indexes into this index. After this completes, the index is optimized. The provided IndexReaders are not closed. See {@link #AddIndexes(Directory[])} for details on transactional semantics, temporary free space required in the Directory, and non-CFS segments on an Exception.
AddIndexesNoOptimize 
Close 
DeleteDocumentsOverloaded. Deletes the document(s) containing any of the terms. All deletes are flushed at the same time.
DocCountReturns the number of documents currently in this index.
Equals (inherited from Object) Determines whether the specified Object is equal to the current Object.
Flush Flush all in-memory buffered updates (adds and deletes) to the Directory.
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 
GetMaxBufferedDeleteTerms 
GetMaxBufferedDocs 
GetMaxFieldLength 
GetMaxMergeDocs 
GetMergeFactor 
GetSimilarity 
GetTermIndexInterval Expert: Return the interval between indexed terms.
GetType (inherited from Object) Gets the Type of the current instance.
GetUseCompoundFile Get 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.
GetWriteLockTimeout 
NumRamDocs Expert: Return the number of documents whose segments are currently cached in memory. Useful when calling flushRamSegments()
Optimize 
RamSizeInBytes Expert: Return the total size of all index files currently cached in memory. Useful for size management with flushRamDocs()
SetInfoStream If non-null, information about merges and a message when maxFieldLength is reached will be printed to this.
SetMaxBufferedDeleteTerms 
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 
SetSimilarity Expert: Set the Similarity implementation used by this IndexWriter.
SetTermIndexInterval Expert: 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.
SetUseCompoundFile Setting 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.
SetWriteLockTimeout Sets the maximum time to wait for a write lock (in milliseconds) for this instance of IndexWriter.
ToString (inherited from Object) Returns a String that represents the current Object.
UpdateDocumentOverloaded. Updates a document by first deleting the document(s) containing
term
and then adding the new document. The delete and then add are atomic as seen by a reader on the same index (flush may happen only after the add).

Protected Instance Methods

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

Protected Internal Instance Methods

MaybeFlushRamSegments 

See Also

IndexWriter Class | Lucene.Net.Index Namespace