Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class DirectoryTaxonomyReader

    A TaxonomyReader which retrieves stored taxonomy information from a Lucene.Net.Store.Directory.

    Reading from the on-disk index on every method call is too slow, so this implementation employs caching: Some methods cache recent requests and their results, while other methods prefetch all the data into memory and then provide answers directly from in-memory tables. See the documentation of individual methods for comments on their performance.

    Note

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

    Inheritance
    System.Object
    TaxonomyReader
    DirectoryTaxonomyReader
    Implements
    System.IDisposable
    Inherited Members
    TaxonomyReader.ROOT_ORDINAL
    TaxonomyReader.INVALID_ORDINAL
    TaxonomyReader.OpenIfChanged<T>(T)
    TaxonomyReader.EnsureOpen()
    TaxonomyReader.Dispose()
    TaxonomyReader.DecRef()
    TaxonomyReader.GetChildren(Int32)
    TaxonomyReader.GetOrdinal(String, String[])
    TaxonomyReader.RefCount
    TaxonomyReader.IncRef()
    TaxonomyReader.TryIncRef()
    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)
    System.Object.ToString()
    Namespace: Lucene.Net.Facet.Taxonomy.Directory
    Assembly: Lucene.Net.Facet.dll
    Syntax
    public class DirectoryTaxonomyReader : TaxonomyReader, IDisposable

    Constructors

    | Improve this Doc View Source

    DirectoryTaxonomyReader(DirectoryTaxonomyWriter)

    Opens a DirectoryTaxonomyReader over the given DirectoryTaxonomyWriter (for NRT).

    Declaration
    public DirectoryTaxonomyReader(DirectoryTaxonomyWriter taxoWriter)
    Parameters
    Type Name Description
    DirectoryTaxonomyWriter taxoWriter

    The DirectoryTaxonomyWriter from which to obtain newly added categories, in real-time.

    | Improve this Doc View Source

    DirectoryTaxonomyReader(Directory)

    Open for reading a taxonomy stored in a given Lucene.Net.Store.Directory.

    Declaration
    public DirectoryTaxonomyReader(Directory directory)
    Parameters
    Type Name Description
    Lucene.Net.Store.Directory directory

    The Lucene.Net.Store.Directory in which the taxonomy resides.

    Exceptions
    Type Condition
    Lucene.Net.Index.CorruptIndexException

    if the Taxonomy is corrupt.

    System.IO.IOException

    if another error occurred.

    Properties

    | Improve this Doc View Source

    CommitUserData

    Declaration
    public override IDictionary<string, string> CommitUserData { get; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.String>
    Overrides
    TaxonomyReader.CommitUserData
    | Improve this Doc View Source

    Count

    Declaration
    public override int Count { get; }
    Property Value
    Type Description
    System.Int32
    Overrides
    TaxonomyReader.Count
    | Improve this Doc View Source

    ParallelTaxonomyArrays

    Declaration
    public override ParallelTaxonomyArrays ParallelTaxonomyArrays { get; }
    Property Value
    Type Description
    ParallelTaxonomyArrays
    Overrides
    TaxonomyReader.ParallelTaxonomyArrays

    Methods

    | Improve this Doc View Source

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    TaxonomyReader.Dispose(Boolean)
    | Improve this Doc View Source

    DoOpenIfChanged()

    Implements the opening of a new DirectoryTaxonomyReader instance if the taxonomy has changed.

    NOTE: the returned DirectoryTaxonomyReader shares the ordinal and category caches with this reader. This is not expected to cause any issues, unless the two instances continue to live. The reader guarantees that the two instances cannot affect each other in terms of correctness of the caches, however if the size of the cache is changed through SetCacheSize(Int32), it will affect both reader instances.

    Declaration
    protected override TaxonomyReader DoOpenIfChanged()
    Returns
    Type Description
    TaxonomyReader
    Overrides
    TaxonomyReader.DoOpenIfChanged()
    | Improve this Doc View Source

    GetOrdinal(FacetLabel)

    Declaration
    public override int GetOrdinal(FacetLabel cp)
    Parameters
    Type Name Description
    FacetLabel cp
    Returns
    Type Description
    System.Int32
    Overrides
    TaxonomyReader.GetOrdinal(FacetLabel)
    | Improve this Doc View Source

    GetPath(Int32)

    Declaration
    public override FacetLabel GetPath(int ordinal)
    Parameters
    Type Name Description
    System.Int32 ordinal
    Returns
    Type Description
    FacetLabel
    Overrides
    TaxonomyReader.GetPath(Int32)
    | Improve this Doc View Source

    OpenIndexReader(IndexWriter)

    Open the Lucene.Net.Index.DirectoryReader from this Lucene.Net.Index.IndexWriter.

    Declaration
    protected virtual DirectoryReader OpenIndexReader(IndexWriter writer)
    Parameters
    Type Name Description
    Lucene.Net.Index.IndexWriter writer
    Returns
    Type Description
    Lucene.Net.Index.DirectoryReader
    | Improve this Doc View Source

    OpenIndexReader(Directory)

    Open the Lucene.Net.Index.DirectoryReader from this Lucene.Net.Store.Directory.

    Declaration
    protected virtual DirectoryReader OpenIndexReader(Directory directory)
    Parameters
    Type Name Description
    Lucene.Net.Store.Directory directory
    Returns
    Type Description
    Lucene.Net.Index.DirectoryReader
    | Improve this Doc View Source

    SetCacheSize(Int32)

    SetCacheSize(Int32) controls the maximum allowed size of each of the caches used by GetPath(Int32) and GetOrdinal(FacetLabel).

    Currently, if the given size is smaller than the current size of a cache, it will not shrink, and rather we be limited to its current size.

    Declaration
    public virtual void SetCacheSize(int size)
    Parameters
    Type Name Description
    System.Int32 size

    The new maximum cache size, in number of entries.

    | Improve this Doc View Source

    ToString(Int32)

    Returns ordinal -> label mapping, up to the provided max ordinal or number of ordinals, whichever is smaller.

    Declaration
    public virtual string ToString(int max)
    Parameters
    Type Name Description
    System.Int32 max
    Returns
    Type Description
    System.String

    Implements

    System.IDisposable
    • 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.