Method AddDocument
AddDocument(IEnumerable<IIndexableField>)
Adds a document to this index.
Note that if an
This method periodically flushes pending documents to the Directory (see IndexWriter), and also periodically triggers segment merges in the index according to the MergePolicy in use.
Merges temporarily consume space in the directory. The amount of space required is up to 1X the size of all segments being merged, when no readers/searchers are open against the index, and up to 2X the size of all segments being merged when readers/searchers are open against the index (see ForceMerge(Int32) for details). The sequence of primitive merge operations performed is governed by the merge policy.
Note that each term in the document can be no longer
than MAX_TERM_LENGTH in bytes, otherwise an
Note that it's possible to create an invalid Unicode string in java if a UTF16 surrogate pair is malformed. In this case, the invalid characters are silently replaced with the Unicode replacement character U+FFFD.
NOTE: if this method hits an
Declaration
public virtual void AddDocument(IEnumerable<IIndexableField> doc)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IIndexableField> | doc |
Exceptions
Type | Condition |
---|---|
CorruptIndexException | if the index is corrupt |
AddDocument(IEnumerable<IIndexableField>, Analyzer)
Adds a document to this index, using the provided analyzer
instead of the
value of Analyzer.
See AddDocument(IEnumerable<IIndexableField>) for details on
index and IndexWriter state after an
NOTE: if this method hits an
Declaration
public virtual void AddDocument(IEnumerable<IIndexableField> doc, Analyzer analyzer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IIndexableField> | doc | |
Analyzer | analyzer |
Exceptions
Type | Condition |
---|---|
CorruptIndexException | if the index is corrupt |