Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class DocValuesFormat

    Encodes/decodes per-document values.

    Note, when extending this class, the name (Name) may written into the index in certain configurations. In order for the segment to be read, the name must resolve to your implementation via ForName(String). This method uses GetDocValuesFormat(String) to resolve format names.

    To implement your own format:

    1. Subclass this class.
    2. Subclass DefaultDocValuesFormatFactory, override the Initialize() method, and add the line base.ScanForDocValuesFormats(typeof(YourDocValuesFormat).Assembly). If you have any format classes in your assembly that are not meant for reading, you can add the ExcludeDocValuesFormatFromScanAttribute to them so they are ignored by the scan.
    3. Set the new IDocValuesFormatFactory by calling SetDocValuesFormatFactory(IDocValuesFormatFactory) at application startup.
    If your format has dependencies, you may also override GetDocValuesFormat(Type) to inject them via pure DI or a DI container. See DI-Friendly Framework to understand the approach used.

    DocValuesFormat Names

    Unlike the Java version, format names are by default convention-based on the class name. If you name your custom format class "MyCustomDocValuesFormat", the format name will the same name without the "DocValuesFormat" suffix: "MyCustom".

    You can override this default behavior by using the DocValuesFormatNameAttribute to name the format differently than this convention. Format names must be all ASCII alphanumeric, and less than 128 characters in length.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    System.Object
    DocValuesFormat
    Lucene40DocValuesFormat
    Lucene42DocValuesFormat
    Lucene45DocValuesFormat
    PerFieldDocValuesFormat
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Codecs
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class DocValuesFormat

    Constructors

    | Improve this Doc View Source

    DocValuesFormat()

    Creates a new docvalues format.

    The provided name will be written into the index segment in some configurations (such as when using PerFieldDocValuesFormat): in such configurations, for the segment to be read this class should be registered by subclassing DefaultDocValuesFormatFactory and calling ScanForDocValuesFormats(Assembly) in the class constructor. The new IDocValuesFormatFactory can be registered by calling SetDocValuesFormatFactory(IDocValuesFormatFactory) at application startup.

    Declaration
    protected DocValuesFormat()

    Properties

    | Improve this Doc View Source

    AvailableDocValuesFormats

    Returns a list of all available format names.

    Declaration
    public static ICollection<string> AvailableDocValuesFormats { get; }
    Property Value
    Type Description
    System.Collections.Generic.ICollection<System.String>
    | Improve this Doc View Source

    Name

    Unique name that's used to retrieve this format when reading the index.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    FieldsConsumer(SegmentWriteState)

    Returns a DocValuesConsumer to write docvalues to the index.

    Declaration
    public abstract DocValuesConsumer FieldsConsumer(SegmentWriteState state)
    Parameters
    Type Name Description
    SegmentWriteState state
    Returns
    Type Description
    DocValuesConsumer
    | Improve this Doc View Source

    FieldsProducer(SegmentReadState)

    Returns a DocValuesProducer to read docvalues from the index.

    NOTE: by the time this call returns, it must hold open any files it will need to use; else, those files may be deleted. Additionally, required files may be deleted during the execution of this call before there is a chance to open them. Under these circumstances an System.IO.IOException should be thrown by the implementation. System.IO.IOExceptions are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.

    Declaration
    public abstract DocValuesProducer FieldsProducer(SegmentReadState state)
    Parameters
    Type Name Description
    SegmentReadState state
    Returns
    Type Description
    DocValuesProducer
    | Improve this Doc View Source

    ForName(String)

    Looks up a format by name.

    Declaration
    public static DocValuesFormat ForName(string name)
    Parameters
    Type Name Description
    System.String name
    Returns
    Type Description
    DocValuesFormat
    | Improve this Doc View Source

    GetDocValuesFormatFactory()

    Gets the associated DocValuesFormat factory.

    Declaration
    public static IDocValuesFormatFactory GetDocValuesFormatFactory()
    Returns
    Type Description
    IDocValuesFormatFactory

    The DocValuesFormat factory.

    | Improve this Doc View Source

    SetDocValuesFormatFactory(IDocValuesFormatFactory)

    Sets the IDocValuesFormatFactory instance used to instantiate DocValuesFormat subclasses.

    Declaration
    public static void SetDocValuesFormatFactory(IDocValuesFormatFactory docValuesFormatFactory)
    Parameters
    Type Name Description
    IDocValuesFormatFactory docValuesFormatFactory

    The new IDocValuesFormatFactory.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The docValuesFormatFactory parameter is null.

    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()

    See Also

    DefaultDocValuesFormatFactory
    IDocValuesFormatFactory
    DocValuesFormatNameAttribute
    • Improve this Doc
    • View Source
    Back to top Copyright © 2022 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.