Show / Hide Table of Contents

    Class CompactLabelToOrdinal

    This is a very efficient LabelToOrdinal implementation that uses a Lucene.Net.Facet.Taxonomy.WriterCache.CharBlockArray to store all labels and a configurable number of Lucene.Net.Facet.Taxonomy.WriterCache.CompactLabelToOrdinal.HashArrays to reference the labels.

    Since the Lucene.Net.Facet.Taxonomy.WriterCache.CompactLabelToOrdinal.HashArrays don't handle collisions, a CollisionMap is used to store the colliding labels.

    This data structure grows by adding a new HashArray whenever the number of collisions in the CollisionMap exceeds Lucene.Net.Facet.Taxonomy.WriterCache.CompactLabelToOrdinal.loadFactor GetMaxOrdinal(). Growing also includes reinserting all colliding labels into the Lucene.Net.Facet.Taxonomy.WriterCache.CompactLabelToOrdinal.HashArrays to possibly reduce the number of collisions.

    For setting the Lucene.Net.Facet.Taxonomy.WriterCache.CompactLabelToOrdinal.loadFactor see CompactLabelToOrdinal(Int32, Single, Int32).

    This data structure has a much lower memory footprint (~30%) compared to a Java HashMap<String, Integer>. It also only uses a small fraction of objects a HashMap would use, thus limiting the GC overhead. Ingestion speed was also ~50% faster compared to a HashMap for 3M unique labels.

    @lucene.experimental

    Inheritance
    System.Object
    LabelToOrdinal
    CompactLabelToOrdinal
    Inherited Members
    LabelToOrdinal.m_counter
    LabelToOrdinal.INVALID_ORDINAL
    LabelToOrdinal.MaxOrdinal
    LabelToOrdinal.GetNextOrdinal()
    Namespace: Lucene.Net.Facet.Taxonomy.WriterCache
    Assembly: Lucene.Net.Facet.dll
    Syntax
    public class CompactLabelToOrdinal : LabelToOrdinal

    Constructors

    | Improve this Doc View Source

    CompactLabelToOrdinal(Int32, Single, Int32)

    Sole constructor.

    Declaration
    public CompactLabelToOrdinal(int initialCapacity, float loadFactor, int numHashArrays)
    Parameters
    Type Name Description
    System.Int32 initialCapacity
    System.Single loadFactor
    System.Int32 numHashArrays

    Fields

    | Improve this Doc View Source

    DefaultLoadFactor

    Default maximum load factor.

    Declaration
    public const float DefaultLoadFactor = null
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    TERMINATOR_CHAR

    Declaration
    public const char TERMINATOR_CHAR = null
    Field Value
    Type Description
    System.Char

    Properties

    | Improve this Doc View Source

    SizeOfMap

    How many labels.

    Declaration
    public virtual int SizeOfMap { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    | Improve this Doc View Source

    AddLabel(FacetLabel, Int32)

    Declaration
    public override void AddLabel(FacetLabel label, int ordinal)
    Parameters
    Type Name Description
    FacetLabel label
    System.Int32 ordinal
    Overrides
    LabelToOrdinal.AddLabel(FacetLabel, Int32)
    | Improve this Doc View Source

    GetOrdinal(FacetLabel)

    Declaration
    public override int GetOrdinal(FacetLabel label)
    Parameters
    Type Name Description
    FacetLabel label
    Returns
    Type Description
    System.Int32
    Overrides
    LabelToOrdinal.GetOrdinal(FacetLabel)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)