Method AddDocuments
AddDocuments(IEnumerable<IEnumerable<IIndexableField>>)
Atomically adds a block of documents with sequentially assigned document IDs, such that an external reader will see all or none of the documents.
WARNING: the index does not currently record which documents were added as a block. Today this is fine, because merging will preserve a block. The order of documents within a segment will be preserved, even when child documents within a block are deleted. Most search features (like result grouping and block joining) require you to mark documents; when these documents are deleted these search features will not work as expected. Obviously adding documents to an existing block will require you the reindex the entire block.
However it's possible that in the future Lucene may merge more aggressively re-order documents (for example, perhaps to obtain better index compression), in which case you may need to fully re-index your documents at that time.
See AddDocument(IEnumerable<IIndexableField>) for details on
index and IndexWriter state after an
NOTE: tools that do offline splitting of an index (for example, IndexSplitter in Lucene.Net.Misc) or re-sorting of documents (for example, IndexSorter in contrib) are not aware of these atomically added documents and will likely break them up. Use such tools at your own risk!
NOTE: if this method hits an
@lucene.experimental
Declaration
public virtual void AddDocuments(IEnumerable<IEnumerable<IIndexableField>> docs)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IEnumerable<IIndexableField>> | docs |
Exceptions
Type | Condition |
---|---|
CorruptIndexException | if the index is corrupt |
AddDocuments(IEnumerable<IEnumerable<IIndexableField>>, Analyzer)
Atomically adds a block of documents, analyzed using the
provided analyzer
, with sequentially assigned document
IDs, such that an external reader will see all or none
of the documents.
@lucene.experimental
Declaration
public virtual void AddDocuments(IEnumerable<IEnumerable<IIndexableField>> docs, Analyzer analyzer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IEnumerable<IIndexableField>> | docs | |
Analyzer | analyzer |
Exceptions
Type | Condition |
---|---|
CorruptIndexException | if the index is corrupt |
AddDocuments(IDictionary<IEnumerable<IIndexableField>, Analyzer>)
Declaration
public void AddDocuments(IDictionary<IEnumerable<IIndexableField>, Analyzer> docsWithAnalyzers)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<IEnumerable<IIndexableField>, Analyzer> | docsWithAnalyzers |