Interface DirectoryTaxonomyWriter.IOrdinalMap
Mapping from old ordinal to new ordinals, used when merging indexes wit separate taxonomies.
AddMapping(int, int) merges one or more taxonomies into the given taxonomy (this). An DirectoryTaxonomyWriter.IOrdinalMap is filled for each of the added taxonomies, containing the new ordinal (in the merged taxonomy) of each of the categories in the old taxonomy. There exist two implementations of DirectoryTaxonomyWriter.IOrdinalMap: DirectoryTaxonomyWriter.MemoryOrdinalMap and DirectoryTaxonomyWriter.DiskOrdinalMap. As their names suggest, the former keeps the map in memory and the latter in a temporary disk file. Because these maps will later be needed one by one (to remap the counting lists), not all at the same time, it is recommended to put the first taxonomy's map in memory, and all the rest on disk (later to be automatically read into memory one by one, when needed).Namespace: Lucene.Net.Facet.Taxonomy.Directory
Assembly: Lucene.Net.Facet.dll
Syntax
public interface DirectoryTaxonomyWriter.IOrdinalMap
Methods
AddDone()
Call AddDone() to say that all AddMapping(int, int) have been done. In some implementations this might free some resources.
Declaration
void AddDone()
AddMapping(int, int)
Record a mapping.
Declaration
void AddMapping(int origOrdinal, int newOrdinal)
Parameters
Type | Name | Description |
---|---|---|
int | origOrdinal | |
int | newOrdinal |
GetMap()
Return the map from the taxonomy's original (consecutive) ordinals to the new taxonomy's ordinals. If the map has to be read from disk and ordered appropriately, it is done when getMap() is called. getMap() should only be called once, and only when the map is actually needed. Calling it will also free all resources that the map might be holding (such as temporary disk space), other than the returned int[].
Declaration
int[] GetMap()
Returns
Type | Description |
---|---|
int[] |
SetSize(int)
Set the size of the map. This MUST be called before AddMapping(int, int).
It is assumed (but not verified) that AddMapping(int, int) will then be
called exactly 'size' times, with different origOrdinals
between 0
and size - 1.
Declaration
void SetSize(int taxonomySize)
Parameters
Type | Name | Description |
---|---|---|
int | taxonomySize |