The IndexModifier type exposes the following members.

Constructors

  NameDescription
Public methodIndexModifier(FileInfo, Analyzer, Boolean)
Open an index with write access.
Public methodIndexModifier(String, Analyzer, Boolean)
Open an index with write access.
Public methodIndexModifier(Directory, Analyzer, Boolean)
Open an index with write access.

Methods

  NameDescription
Public methodAddDocument(Document)
Adds a document to this index. If the document contains more than {@link #SetMaxFieldLength(int)} terms for a given field, the remainder are discarded.
Public methodAddDocument(Document, Analyzer)
Adds a document to this index, using the provided analyzer instead of the one specific in the constructor. If the document contains more than {@link #SetMaxFieldLength(int)} terms for a given field, the remainder are discarded.
Protected methodAssureOpen
Throw an IllegalStateException if the index is closed.
Public methodClose
Close this index, writing all pending changes to disk.
Protected methodCreateIndexReader
Close the IndexWriter and open an IndexReader.
Protected methodCreateIndexWriter
Close the IndexReader and open an IndexWriter.
Public methodDeleteDocument
Deletes the document numbered
CopyC#
docNum
.
Public methodDeleteDocuments
Deletes all documents containing
CopyC#
term
. This is useful if one uses a document field to hold a unique ID string for the document. Then to delete such a document, one merely constructs a term with the appropriate field and the unique ID string as its text and passes it to this method. Returns the number of documents deleted.
Public methodDocCount
Returns the number of documents currently in this index. If the writer is currently open, this returns {@link IndexWriter#DocCount()}, else {@link IndexReader#NumDocs()}. But, note that {@link IndexWriter#DocCount()} does not take deletions into account, unlike {@link IndexReader#numDocs}.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlush
Make sure all changes are written to disk.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetInfoStream
has this index open (
CopyC#
write.lock
could not be obtained)
Public methodGetMaxBufferedDocs
has this index open (
CopyC#
write.lock
could not be obtained)
Public methodGetMaxFieldLength
has this index open (
CopyC#
write.lock
could not be obtained)
Public methodGetMergeFactor
has this index open (
CopyC#
write.lock
could not be obtained)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUseCompoundFile
has this index open (
CopyC#
write.lock
could not be obtained)
Protected methodInit
Initialize an IndexWriter.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOptimize
Merges all segments together into a single segment, optimizing an index for search.
Public methodSetInfoStream
If non-null, information about merges and a message when {@link #GetMaxFieldLength()} is reached will be printed to this.

Example: index.setInfoStream(System.err);

Public methodSetMaxBufferedDocs
Determines the minimal number of documents required before the buffered in-memory documents are merging and a new Segment is created. Since Documents are merged in a {@link Lucene.Net.Store.RAMDirectory}, large value gives faster indexing. At the same time, mergeFactor limits the number of files open in a FSDirectory.

The default value is 10.

Public methodSetMaxFieldLength
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 accommodate 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.

Public methodSetMergeFactor
Determines how often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster. Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained.

This must never be less than 2. The default value is 10.

Public methodSetUseCompoundFile
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.
Public methodToString (Overrides Object..::..ToString()()()().)

Fields

See Also