Module org.apache.lucene.facet
Class TaxonomyIndexArrays
java.lang.Object
org.apache.lucene.facet.taxonomy.ParallelTaxonomyArrays
org.apache.lucene.facet.taxonomy.directory.TaxonomyIndexArrays
- All Implemented Interfaces:
Accountable
A
ParallelTaxonomyArrays
that are initialized from the taxonomy index.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Nested classes/interfaces inherited from class org.apache.lucene.facet.taxonomy.ParallelTaxonomyArrays
ParallelTaxonomyArrays.IntArray
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
(package private) static final int
private static final int
private boolean
private final TaxonomyIndexArrays.ChunkedIntArray
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
ConstructorsConstructorDescriptionTaxonomyIndexArrays
(int[][] parents) Used byadd(int, int)
after the array grew.TaxonomyIndexArrays
(IndexReader reader) TaxonomyIndexArrays
(IndexReader reader, TaxonomyIndexArrays copyFrom) -
Method Summary
Modifier and TypeMethodDescription(package private) TaxonomyIndexArrays
add
(int ordinal, int parentOrdinal) Adds the given ordinal/parent info and returns either a new instance if the underlying array had to grow, or this instance otherwise.private static int[][]
allocateChunkedArray
(int size, int startFrom) children()
Returns the children array, wherechildren[i]
denotes the youngest child of category ordinali
.private void
computeChildrenSiblings
(int first) private static void
copyChunkedArray
(int[][] oldArray, int[][] newArray) Returns nested resources of this class.private static int
getMajorVersion
(IndexReader reader) private void
initChildrenSiblings
(TaxonomyIndexArrays copyFrom) private void
initParents
(int[][] parentsArray, IndexReader reader, int first) private void
loadParentUsingTermPosition
(int[][] parentsArray, IndexReader reader, int first) Try loading the old way of storing parent ordinal first, return true if the parent array is loaded Or false if not, and we will try loading using NumericDocValuesparents()
Returns the parents array, whereparents[i]
denotes the parent of category ordinali
.long
Return the memory usage of this object in bytes.siblings()
Returns the siblings array, wheresiblings[i]
denotes the sibling of category ordinali
.
-
Field Details
-
CHUNK_SIZE_BITS
private static final int CHUNK_SIZE_BITS- See Also:
-
CHUNK_SIZE
static final int CHUNK_SIZE- See Also:
-
CHUNK_MASK
private static final int CHUNK_MASK- See Also:
-
parents
-
initializedChildren
private volatile boolean initializedChildren -
children
-
siblings
-
-
Constructor Details
-
TaxonomyIndexArrays
TaxonomyIndexArrays(int[][] parents) Used byadd(int, int)
after the array grew. Also, used for testing. -
TaxonomyIndexArrays
- Throws:
IOException
-
TaxonomyIndexArrays
- Throws:
IOException
-
-
Method Details
-
allocateChunkedArray
private static int[][] allocateChunkedArray(int size, int startFrom) -
copyChunkedArray
private static void copyChunkedArray(int[][] oldArray, int[][] newArray) -
initChildrenSiblings
-
computeChildrenSiblings
private void computeChildrenSiblings(int first) -
initParents
- Throws:
IOException
-
getMajorVersion
-
loadParentUsingTermPosition
private void loadParentUsingTermPosition(int[][] parentsArray, IndexReader reader, int first) throws IOException Try loading the old way of storing parent ordinal first, return true if the parent array is loaded Or false if not, and we will try loading using NumericDocValues- Throws:
IOException
-
add
Adds the given ordinal/parent info and returns either a new instance if the underlying array had to grow, or this instance otherwise.NOTE: you should call this method from a thread-safe code.
-
parents
Returns the parents array, whereparents[i]
denotes the parent of category ordinali
.- Specified by:
parents
in classParallelTaxonomyArrays
-
children
Returns the children array, wherechildren[i]
denotes the youngest child of category ordinali
. The youngest child is defined as the category that was added last to the taxonomy as an immediate child ofi
.- Specified by:
children
in classParallelTaxonomyArrays
-
siblings
Returns the siblings array, wheresiblings[i]
denotes the sibling of category ordinali
. The sibling is defined as the previous youngest child ofparents[i]
.- Specified by:
siblings
in classParallelTaxonomyArrays
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
getChildResources
Description copied from interface:Accountable
Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).- Specified by:
getChildResources
in interfaceAccountable
- See Also:
-