C# Class Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader

A TaxonomyReader which retrieves stored taxonomy information from a 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. @lucene.experimental

Inheritance: TaxonomyReader, IDisposable
Show file Open project: apache/lucenenet Class Usage Examples

Private Properties

Property Type Description
DirectoryTaxonomyReader System
InitTaxoArrays void

Public Methods

Method Description
DirectoryTaxonomyReader ( Directory directory ) : System

Open for reading a taxonomy stored in a given Directory.

DirectoryTaxonomyReader ( DirectoryTaxonomyWriter taxoWriter ) : System

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

Dispose ( ) : void
GetOrdinal ( FacetLabel cp ) : int
GetPath ( int ordinal ) : FacetLabel
ToString ( int max ) : string

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

Protected Methods

Method Description
DoClose ( ) : void
DoOpenIfChanged ( ) : TaxonomyReader

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 CacheSize, it will affect both reader instances.

OpenIndexReader ( Directory directory ) : DirectoryReader

Open the DirectoryReader from this Directory.

OpenIndexReader ( IndexWriter writer ) : DirectoryReader

Open the DirectoryReader from this IndexWriter.

Private Methods

Method Description
DirectoryTaxonomyReader ( DirectoryReader indexReader, DirectoryTaxonomyWriter taxoWriter, IntClass>.LRUHashMap ordinalCache, FacetLabel>.LRUHashMap categoryCache, TaxonomyIndexArrays taxoArrays ) : System

Called only from DoOpenIfChanged(). If the taxonomy has been recreated, you should pass null as the caches and parent/children arrays.

InitTaxoArrays ( ) : void

Method Details

DirectoryTaxonomyReader() public method

Open for reading a taxonomy stored in a given Directory.
if the Taxonomy is corrupt. if another error occurred.
public DirectoryTaxonomyReader ( Directory directory ) : System
directory System.IO.Directory The in which the taxonomy resides.
return System

DirectoryTaxonomyReader() public method

Opens a DirectoryTaxonomyReader over the given DirectoryTaxonomyWriter (for NRT).
public DirectoryTaxonomyReader ( DirectoryTaxonomyWriter taxoWriter ) : System
taxoWriter DirectoryTaxonomyWriter /// The from which to obtain newly /// added categories, in real-time.
return System

Dispose() public method

public Dispose ( ) : void
return void

DoClose() protected method

protected DoClose ( ) : void
return void

DoOpenIfChanged() protected method

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 CacheSize, it will affect both reader instances.

protected DoOpenIfChanged ( ) : TaxonomyReader
return TaxonomyReader

GetOrdinal() public method

public GetOrdinal ( FacetLabel cp ) : int
cp FacetLabel
return int

GetPath() public method

public GetPath ( int ordinal ) : FacetLabel
ordinal int
return FacetLabel

OpenIndexReader() protected method

Open the DirectoryReader from this Directory.
protected OpenIndexReader ( Directory directory ) : DirectoryReader
directory System.IO.Directory
return DirectoryReader

OpenIndexReader() protected method

Open the DirectoryReader from this IndexWriter.
protected OpenIndexReader ( IndexWriter writer ) : DirectoryReader
writer IndexWriter
return DirectoryReader

ToString() public method

Returns ordinal -> label mapping, up to the provided max ordinal or number of ordinals, whichever is smaller.
public ToString ( int max ) : string
max int
return string