Package org.apache.lucene.util.bkd
Class BKDReader.BKDPointTree
java.lang.Object
org.apache.lucene.util.bkd.BKDReader.BKDPointTree
- All Implemented Interfaces:
Cloneable
,PointValues.PointTree
- Enclosing class:
- BKDReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
private final BKDConfig
private final DocIdsWriter
private final IndexInput
private final boolean
private final int
private final long[]
private final int
private final IndexInput
private int
private final byte[]
private final byte[]
private final boolean[]
private int
private final int
(package private) final long
private final int[]
private final int
private final int[]
private final byte[]
private final BKDReader.BKDReaderDocIDSetIterator
private final byte[]
private final byte[]
private final int[]
private final byte[][]
private final byte[][]
private final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
BKDPointTree
(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, byte[] minPackedValue, byte[] maxPackedValue, boolean isTreeBalanced) private
BKDPointTree
(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, int nodeID, int level, byte[] minPackedValue, byte[] maxPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, int[] commonPrefixLengths, boolean isTreeBalanced) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(PointValues.IntersectVisitor visitor, boolean grown) private int
balanceTreeNodePosition
(int minNode, int maxNode, int node, int position, int level) clone()
Clone, the current node becomes the root of the new tree.private long
Only valid after pushLeft or pushRight, not pop!byte[]
Return the maximum packed value of the current node.byte[]
Return the minimum packed value of the current node.private int
getNumLeavesSlow
(int node) private int
getTreeDepth
(int numLeaves) private boolean
private boolean
private boolean
boolean
Move to the first child node and returntrue
upon success.boolean
Move to the parent node and returntrue
upon success.boolean
Move to the next sibling node and returntrue
upon success.private boolean
private void
pop()
private void
popBounds
(byte[] packedValue) private void
private void
private void
pushLeft()
private void
private void
readCommonPrefixes
(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in) private int
private int
readDocIDs
(IndexInput in, long blockFP, BKDReader.BKDReaderDocIDSetIterator iterator) private void
readMinMax
(int[] commonPrefixLengths, byte[] minPackedValue, byte[] maxPackedValue, IndexInput in) private void
readNodeData
(boolean isLeft) private void
long
size()
Return the number of points below the current node.private long
sizeFromBalancedTree
(int leftMostLeafNode, int rightMostLeafNode) toString()
private void
visitCompressedDocValues
(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor, int compressedDim) void
visitDocIDs
(PointValues.IntersectVisitor visitor) Visit all the docs below the current node.void
Visit all the docs and values below the current node.private void
visitDocValues
(PointValues.IntersectVisitor visitor, long fp) private void
visitDocValuesNoCardinality
(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) private void
visitDocValuesWithCardinality
(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) private void
private void
visitSparseRawDocValues
(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) private void
visitUniqueRawDocValues
(byte[] scratchPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor)
-
Field Details
-
nodeID
private int nodeID -
nodeRoot
private final int nodeRoot -
level
private int level -
innerNodes
-
leafNodes
-
leafBlockFPStack
private final long[] leafBlockFPStack -
readNodeDataPositions
private final int[] readNodeDataPositions -
rightNodePositions
private final int[] rightNodePositions -
splitDimsPos
private final int[] splitDimsPos -
negativeDeltas
private final boolean[] negativeDeltas -
splitValuesStack
private final byte[][] splitValuesStack -
minPackedValue
private final byte[] minPackedValue -
maxPackedValue
private final byte[] maxPackedValue -
splitDimValueStack
private final byte[][] splitDimValueStack -
config
-
leafNodeOffset
private final int leafNodeOffset -
version
private final int version -
pointCount
final long pointCount -
lastLeafNodePointCount
private final int lastLeafNodePointCount -
rightMostLeafNode
private final int rightMostLeafNode -
scratchDataPackedValue
private final byte[] scratchDataPackedValue -
scratchMinIndexPackedValue
private final byte[] scratchMinIndexPackedValue -
scratchMaxIndexPackedValue
private final byte[] scratchMaxIndexPackedValue -
commonPrefixLengths
private final int[] commonPrefixLengths -
scratchIterator
-
docIdsWriter
-
isTreeBalanced
private final boolean isTreeBalanced
-
-
Constructor Details
-
BKDPointTree
private BKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, byte[] minPackedValue, byte[] maxPackedValue, boolean isTreeBalanced) throws IOException - Throws:
IOException
-
BKDPointTree
private BKDPointTree(IndexInput innerNodes, IndexInput leafNodes, BKDConfig config, int numLeaves, int version, long pointCount, int nodeID, int level, byte[] minPackedValue, byte[] maxPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, int[] commonPrefixLengths, boolean isTreeBalanced)
-
-
Method Details
-
clone
Description copied from interface:PointValues.PointTree
Clone, the current node becomes the root of the new tree.- Specified by:
clone
in interfacePointValues.PointTree
- Overrides:
clone
in classObject
-
getMinPackedValue
public byte[] getMinPackedValue()Description copied from interface:PointValues.PointTree
Return the minimum packed value of the current node.- Specified by:
getMinPackedValue
in interfacePointValues.PointTree
-
getMaxPackedValue
public byte[] getMaxPackedValue()Description copied from interface:PointValues.PointTree
Return the maximum packed value of the current node.- Specified by:
getMaxPackedValue
in interfacePointValues.PointTree
-
moveToChild
Description copied from interface:PointValues.PointTree
Move to the first child node and returntrue
upon success. Returnsfalse
for leaf nodes andtrue
otherwise.- Specified by:
moveToChild
in interfacePointValues.PointTree
- Throws:
IOException
-
resetNodeDataPosition
- Throws:
IOException
-
pushBoundsLeft
private void pushBoundsLeft() -
pushLeft
- Throws:
IOException
-
pushBoundsRight
private void pushBoundsRight() -
pushRight
- Throws:
IOException
-
moveToSibling
Description copied from interface:PointValues.PointTree
Move to the next sibling node and returntrue
upon success. Returnsfalse
if the current node has no more siblings.- Specified by:
moveToSibling
in interfacePointValues.PointTree
- Throws:
IOException
-
pop
private void pop() -
popBounds
private void popBounds(byte[] packedValue) -
moveToParent
public boolean moveToParent()Description copied from interface:PointValues.PointTree
Move to the parent node and returntrue
upon success. Returnsfalse
for the root node andtrue
otherwise.- Specified by:
moveToParent
in interfacePointValues.PointTree
-
isRootNode
private boolean isRootNode() -
isLeftNode
private boolean isLeftNode() -
isLeafNode
private boolean isLeafNode() -
nodeExists
private boolean nodeExists() -
getLeafBlockFP
private long getLeafBlockFP()Only valid after pushLeft or pushRight, not pop! -
size
public long size()Description copied from interface:PointValues.PointTree
Return the number of points below the current node.- Specified by:
size
in interfacePointValues.PointTree
-
sizeFromBalancedTree
private long sizeFromBalancedTree(int leftMostLeafNode, int rightMostLeafNode) -
balanceTreeNodePosition
private int balanceTreeNodePosition(int minNode, int maxNode, int node, int position, int level) -
visitDocIDs
Description copied from interface:PointValues.PointTree
Visit all the docs below the current node.- Specified by:
visitDocIDs
in interfacePointValues.PointTree
- Throws:
IOException
-
addAll
- Throws:
IOException
-
visitDocValues
Description copied from interface:PointValues.PointTree
Visit all the docs and values below the current node.- Specified by:
visitDocValues
in interfacePointValues.PointTree
- Throws:
IOException
-
visitLeavesOneByOne
- Throws:
IOException
-
visitDocValues
- Throws:
IOException
-
readDocIDs
private int readDocIDs(IndexInput in, long blockFP, BKDReader.BKDReaderDocIDSetIterator iterator) throws IOException - Throws:
IOException
-
getNumLeavesSlow
private int getNumLeavesSlow(int node) -
readNodeData
- Throws:
IOException
-
getTreeDepth
private int getTreeDepth(int numLeaves) -
visitDocValuesNoCardinality
private void visitDocValuesNoCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws IOException - Throws:
IOException
-
visitDocValuesWithCardinality
private void visitDocValuesWithCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws IOException - Throws:
IOException
-
readMinMax
private void readMinMax(int[] commonPrefixLengths, byte[] minPackedValue, byte[] maxPackedValue, IndexInput in) throws IOException - Throws:
IOException
-
visitSparseRawDocValues
private void visitSparseRawDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws IOException - Throws:
IOException
-
visitUniqueRawDocValues
private void visitUniqueRawDocValues(byte[] scratchPackedValue, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor) throws IOException - Throws:
IOException
-
visitCompressedDocValues
private void visitCompressedDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, BKDReader.BKDReaderDocIDSetIterator scratchIterator, int count, PointValues.IntersectVisitor visitor, int compressedDim) throws IOException - Throws:
IOException
-
readCompressedDim
- Throws:
IOException
-
readCommonPrefixes
private void readCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in) throws IOException - Throws:
IOException
-
toString
-