Show / Hide Table of Contents

    Class DefaultDocValuesFormatFactory

    LUCENENET specific class that implements the default functionality for the IDocValuesFormatFactory.

    The most common use cases are:

    • Initialize DefaultDocValuesFormatFactory with a set of CustomDocValuesFormatTypes.
    • Subclass DefaultDocValuesFormatFactory and override GetDocValuesFormat(Type) so an external dependency injection container can be used to supply the instances (lifetime should be singleton). Note that you could alternately use the "named type" feature that many DI containers have to supply the type based on name by overriding GetDocValuesFormat(String).
    • Subclass DefaultDocValuesFormatFactory and override GetDocValuesFormatType(String) so a type new type can be supplied that is not in the Lucene.Net.Codecs.DefaultDocValuesFormatFactory.docValuesFormatNameToTypeMap.
    • Subclass DefaultDocValuesFormatFactory to add new or override the default DocValuesFormat types by overriding Initialize() and calling PutDocValuesFormatType(Type).
    • Subclass DefaultDocValuesFormatFactory to scan additional assemblies for DocValuesFormat subclasses in by overriding Initialize() and calling ScanForDocValuesFormats(Assembly). For performance reasons, the default behavior only loads Lucene.Net codecs.

    To set the IDocValuesFormatFactory, call SetDocValuesFormatFactory(IDocValuesFormatFactory).

    Inheritance
    System.Object
    NamedServiceFactory<DocValuesFormat>
    DefaultDocValuesFormatFactory
    Implements
    IDocValuesFormatFactory
    IServiceListable
    Inherited Members
    NamedServiceFactory<DocValuesFormat>.m_initializationLock
    NamedServiceFactory<DocValuesFormat>.EnsureInitialized()
    NamedServiceFactory<DocValuesFormat>.CodecsAssembly
    NamedServiceFactory<DocValuesFormat>.IsServiceType(Type)
    NamedServiceFactory<DocValuesFormat>.GetServiceName(Type)
    NamedServiceFactory<DocValuesFormat>.GetCanonicalName(Type)
    NamedServiceFactory<DocValuesFormat>.IsFullyTrusted
    Namespace: Lucene.Net.Codecs
    Assembly: Lucene.Net.dll
    Syntax
    public class DefaultDocValuesFormatFactory : NamedServiceFactory<DocValuesFormat>, IDocValuesFormatFactory, IServiceListable

    Constructors

    | Improve this Doc View Source

    DefaultDocValuesFormatFactory()

    Creates a new instance of DefaultDocValuesFormatFactory.

    Declaration
    public DefaultDocValuesFormatFactory()

    Properties

    | Improve this Doc View Source

    AvailableServices

    Gets a list of the available DocValuesFormats (by name).

    Declaration
    public virtual ICollection<string> AvailableServices { get; }
    Property Value
    Type Description
    ICollection<System.String>

    A ICollection{string} of DocValuesFormat names.

    | Improve this Doc View Source

    CustomDocValuesFormatTypes

    An array of custom DocValuesFormat-derived types to be registered. This property can be initialized during construction of DefaultDocValuesFormatFactory to make your custom codecs known to Lucene.

    These types will be registered after the default Lucene types, so if a custom type has the same name as a Lucene DocValuesFormat (via DocValuesFormatNameAttribute) the custom type will replace the Lucene type with the same name.

    Declaration
    public IEnumerable<Type> CustomDocValuesFormatTypes { get; set; }
    Property Value
    Type Description
    IEnumerable<Type>

    Methods

    | Improve this Doc View Source

    GetDocValuesFormat(String)

    Gets the DocValuesFormat instance from the provided name.

    Declaration
    public virtual DocValuesFormat GetDocValuesFormat(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the DocValuesFormat instance to retrieve.

    Returns
    Type Description
    DocValuesFormat

    The DocValuesFormat instance.

    | Improve this Doc View Source

    GetDocValuesFormat(Type)

    Gets the DocValuesFormat instance from the provided type.

    Declaration
    protected virtual DocValuesFormat GetDocValuesFormat(Type type)
    Parameters
    Type Name Description
    Type type

    The of DocValuesFormat to retrieve.

    Returns
    Type Description
    DocValuesFormat

    The DocValuesFormat instance.

    | Improve this Doc View Source

    GetDocValuesFormatType(String)

    Gets the DocValuesFormat from the provided name.

    Declaration
    protected virtual Type GetDocValuesFormatType(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the DocValuesFormat to retrieve.

    Returns
    Type Description
    Type

    The DocValuesFormat .

    | Improve this Doc View Source

    Initialize()

    Initializes the doc values type cache with the known DocValuesFormat types. Override this method (and optionally call base.Initialize()) to add your own DocValuesFormat types by calling PutDocValuesFormatType(Type) or ScanForDocValuesFormats(Assembly).

    If two types have the same name by using the DocValuesFormatNameAttribute, the last one registered wins.

    Declaration
    protected override void Initialize()
    Overrides
    Lucene.Net.Util.NamedServiceFactory<Lucene.Net.Codecs.DocValuesFormat>.Initialize()
    | Improve this Doc View Source

    NewDocValuesFormat(Type)

    Instantiates a DocValuesFormat based on the provided type.

    Declaration
    protected virtual DocValuesFormat NewDocValuesFormat(Type type)
    Parameters
    Type Name Description
    Type type

    The of DocValuesFormat to instantiate.

    Returns
    Type Description
    DocValuesFormat

    The new instance.

    | Improve this Doc View Source

    PutDocValuesFormatType(Type)

    Adds a DocValuesFormat type to the Lucene.Net.Codecs.DefaultDocValuesFormatFactory.docValuesFormatNameToTypeMap, using the name provided in the DocValuesFormatNameAttribute, if present, or the name of the codec class minus the "DocValuesFormat" suffix as the name by default.

    Note that if a DocValuesFormat with the same name already exists in the map, calling this method will update it to the new type.

    Declaration
    protected virtual void PutDocValuesFormatType(Type docValuesFormat)
    Parameters
    Type Name Description
    Type docValuesFormat

    A type that subclasses DocValuesFormat.

    | Improve this Doc View Source

    ScanForDocValuesFormats(Assembly)

    Scans the given assembly for subclasses of DocValuesFormat and adds their names to the Lucene.Net.Codecs.DefaultDocValuesFormatFactory.docValuesFormatNameToTypeMap. Note that names will be automatically overridden if the DocValuesFormat name appears multiple times - the last match wins.

    Declaration
    protected virtual void ScanForDocValuesFormats(Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly to scan.

    | Improve this Doc View Source

    ScanForDocValuesFormats(IEnumerable<Assembly>)

    Scans the given assemblies for subclasses of Codec and adds their names to the Lucene.Net.Codecs.DefaultDocValuesFormatFactory.docValuesFormatNameToTypeMap. Note that names will be automatically overridden if the DocValuesFormat name appears multiple times - the last match wins.

    Declaration
    protected virtual void ScanForDocValuesFormats(IEnumerable<Assembly> assemblies)
    Parameters
    Type Name Description
    IEnumerable<Assembly> assemblies

    A list of assemblies to scan. The assemblies will be scanned from first to last, and the last match for each DocValuesFormat name wins.

    Implements

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