Show / Hide Table of Contents

    Class PostingsFormat

    Encodes/decodes terms, postings, and proximity data.

    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 GetPostingsFormat(String) to resolve format names.

    If you implement your own format:

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

    PostingsFormat Names

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

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

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    PostingsFormat
    Lucene40PostingsFormat
    Lucene41PostingsFormat
    PerFieldPostingsFormat
    Namespace: Lucene.Net.Codecs
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class PostingsFormat : object

    Constructors

    | Improve this Doc View Source

    PostingsFormat()

    Creates a new postings format.

    The provided name will be written into the index segment in some configurations (such as when using PerFieldPostingsFormat): in such configurations, for the segment to be read this class should be registered by subclassing DefaultPostingsFormatFactory and calling in the class constructor. The new IPostingsFormatFactory can be registered by calling SetPostingsFormatFactory(IPostingsFormatFactory) at application startup.

    Declaration
    protected PostingsFormat()

    Fields

    | Improve this Doc View Source

    EMPTY

    Zero-length PostingsFormat array.

    Declaration
    public static readonly PostingsFormat[] EMPTY
    Field Value
    Type Description
    PostingsFormat[]

    Properties

    | Improve this Doc View Source

    AvailablePostingsFormats

    Returns a list of all available format names.

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

    Name

    Returns this posting format's name.

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

    Methods

    | Improve this Doc View Source

    FieldsConsumer(SegmentWriteState)

    Writes a new segment.

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

    FieldsProducer(SegmentReadState)

    Reads a segment. 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 should be thrown by the implementation. s are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.

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

    ForName(String)

    Looks up a format by name.

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

    GetPostingsFormatFactory()

    Gets the associated PostingsFormat factory.

    Declaration
    public static IPostingsFormatFactory GetPostingsFormatFactory()
    Returns
    Type Description
    IPostingsFormatFactory

    The PostingsFormat factory.

    | Improve this Doc View Source

    SetPostingsFormatFactory(IPostingsFormatFactory)

    Sets the IPostingsFormatFactory instance used to instantiate PostingsFormat subclasses.

    Declaration
    public static void SetPostingsFormatFactory(IPostingsFormatFactory postingsFormatFactory)
    Parameters
    Type Name Description
    IPostingsFormatFactory postingsFormatFactory

    The new IPostingsFormatFactory.

    | Improve this Doc View Source

    ToString()

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

    See Also

    DefaultPostingsFormatFactory
    IPostingsFormatFactory
    PostingsFormatNameAttribute
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)