Class StoredFieldsWriter
Codec API for writing stored fields:
- For every document, StartDocument(Int32) is called, informing the Codec how many fields will be written.
- WriteField(FieldInfo, IIndexableField) is called for each field in the document.
- After all documents have been written, Finish(FieldInfos, Int32) is called for verification/sanity-checks.
- Finally the writer is disposed (Dispose(Boolean))
Inheritance
Namespace: Lucene.Net.Codecs
Assembly: Lucene.Net.dll
Syntax
public abstract class StoredFieldsWriter : IDisposable
Constructors
| Improve this Doc View SourceStoredFieldsWriter()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected StoredFieldsWriter()
Methods
| Improve this Doc View SourceAbort()
Aborts writing entirely, implementation should remove any partially-written files, etc.
Declaration
public abstract void Abort()
AddDocument<T1>(IEnumerable<T1>, FieldInfos)
Sugar method for StartDocument(Int32) + WriteField(FieldInfo, IIndexableField) for every stored field in the document.
Declaration
protected void AddDocument<T1>(IEnumerable<T1> doc, FieldInfos fieldInfos)
where T1 : IIndexableField
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T1> | doc | |
FieldInfos | fieldInfos |
Type Parameters
Name | Description |
---|---|
T1 |
Dispose()
Disposes all resources used by this object.
Declaration
public void Dispose()
Dispose(Boolean)
Implementations must override and should dispose all resources used by this instance.
Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Finish(FieldInfos, Int32)
Called before Dispose(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to StartDocument(Int32), but a Codec should check that this is the case to detect the bug described in LUCENE-1282.
Declaration
public abstract void Finish(FieldInfos fis, int numDocs)
Parameters
Type | Name | Description |
---|---|---|
FieldInfos | fis | |
System.Int32 | numDocs |
FinishDocument()
Called when a document and all its fields have been added.
Declaration
public virtual void FinishDocument()
Merge(MergeState)
Merges in the stored fields from the readers in
mergeState
. The default implementation skips
over deleted documents, and uses StartDocument(Int32),
WriteField(FieldInfo, IIndexableField), and Finish(FieldInfos, Int32),
returning the number of documents that were written.
Implementations can override this method for more sophisticated
merging (bulk-byte copying, etc).
Declaration
public virtual int Merge(MergeState mergeState)
Parameters
Type | Name | Description |
---|---|---|
MergeState | mergeState |
Returns
Type | Description |
---|---|
System.Int32 |
StartDocument(Int32)
Called before writing the stored fields of the document.
WriteField(FieldInfo, IIndexableField) will be called
numStoredFields
times. Note that this is
called even if the document has no stored fields, in
this case numStoredFields
will be zero.
Declaration
public abstract void StartDocument(int numStoredFields)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | numStoredFields |
WriteField(FieldInfo, IIndexableField)
Writes a single stored field.
Declaration
public abstract void WriteField(FieldInfo info, IIndexableField field)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | info | |
IIndexableField | field |