Show / Hide Table of Contents

    Class StoredFieldsWriter

    Codec API for writing stored fields:

    1. For every document, StartDocument(Int32) is called, informing the Codec how many fields will be written.
    2. WriteField(FieldInfo, IIndexableField) is called for each field in the document.
    3. After all documents have been written, Finish(FieldInfos, Int32) is called for verification/sanity-checks.
    4. Finally the writer is disposed (Dispose(Boolean))

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    StoredFieldsWriter
    CompressingStoredFieldsWriter
    Lucene40StoredFieldsWriter
    Namespace: Lucene.Net.Codecs
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class StoredFieldsWriter : IDisposable

    Constructors

    | Improve this Doc View Source

    StoredFieldsWriter()

    Sole constructor. (For invocation by subclass constructors, typically implicit.)

    Declaration
    protected StoredFieldsWriter()

    Methods

    | Improve this Doc View Source

    Abort()

    Aborts writing entirely, implementation should remove any partially-written files, etc.

    Declaration
    public abstract void Abort()
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Dispose()

    Disposes all resources used by this object.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    FinishDocument()

    Called when a document and all its fields have been added.

    Declaration
    public virtual void FinishDocument()
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)