Class SimpleTextBKDReader
- java.lang.Object
-
- org.apache.lucene.index.PointValues
-
- org.apache.lucene.codecs.simpletext.SimpleTextBKDReader
-
- All Implemented Interfaces:
Accountable
final class SimpleTextBKDReader extends PointValues implements Accountable
Forked fromBKDReaderand simplified/specialized for SimpleText's usage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleTextBKDReader.IntersectStateUsed to track all state for a single call tointersect(org.apache.lucene.index.PointValues.IntersectVisitor).-
Nested classes/interfaces inherited from class org.apache.lucene.index.PointValues
PointValues.IntersectVisitor, PointValues.Relation
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intbytesPerDim(package private) intbytesPerIndexEntry(package private) intdocCount(package private) IndexInputin(package private) long[]leafBlockFPsprivate intleafNodeOffset(package private) byte[]maxPackedValue(package private) intmaxPointsInLeafNode(package private) byte[]minPackedValue(package private) intnumDims(package private) intnumIndexDimsprotected intpackedBytesLengthprotected intpackedIndexBytesLength(package private) longpointCountprivate byte[]splitPackedValues(package private) intversion-
Fields inherited from class org.apache.lucene.index.PointValues
MAX_DIMENSIONS, MAX_INDEX_DIMENSIONS, MAX_NUM_BYTES
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description SimpleTextBKDReader(IndexInput in, int numDims, int numIndexDims, int maxPointsInLeafNode, int bytesPerDim, long[] leafBlockFPs, byte[] splitPackedValues, byte[] minPackedValue, byte[] maxPackedValue, long pointCount, int docCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddAll(SimpleTextBKDReader.IntersectState state, int nodeID)Fast path: this is called when the query box fully encompasses all cells under this node.voidcopySplitValue(int nodeID, byte[] splitPackedValue)Copies the split value for this node into the provided byte arrayprivate longestimatePointCount(SimpleTextBKDReader.IntersectState state, int nodeID, byte[] cellMinPacked, byte[] cellMaxPacked)longestimatePointCount(PointValues.IntersectVisitor visitor)Estimate the number of points that would be visited byPointValues.intersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor.intgetBytesPerDimension()Returns the number of bytes per dimensionintgetDocCount()Returns the total number of documents that have indexed at least one point.SimpleTextBKDReader.IntersectStategetIntersectState(PointValues.IntersectVisitor visitor)Create a newSimpleTextBKDReader.IntersectStatebyte[]getMaxPackedValue()Returns maximum value for each dimension, packed, or null ifPointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)is0byte[]getMinPackedValue()Returns minimum value for each dimension, packed, or null ifPointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)is0intgetNumDimensions()Returns how many dimensions are represented in the valuesintgetNumIndexDimensions()Returns how many dimensions are used for the indexprivate voidintersect(SimpleTextBKDReader.IntersectState state, int nodeID, byte[] cellMinPacked, byte[] cellMaxPacked)voidintersect(PointValues.IntersectVisitor visitor)Finds all documents and points matching the provided visitor.booleanisLeafNode(int nodeID)private intparseInt(BytesRefBuilder scratch, BytesRef prefix)longramBytesUsed()Return the memory usage of this object in bytes.private voidreadCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in)private intreadCompressedDim(IndexInput in)(package private) intreadDocIDs(IndexInput in, long blockFP, int[] docIDs)private voidreadLine(IndexInput in, BytesRefBuilder scratch)longsize()Returns the total number of indexed points across all documents.private booleanstartsWith(BytesRefBuilder scratch, BytesRef prefix)private java.lang.StringstripPrefix(BytesRefBuilder scratch, BytesRef prefix)private voidvisitCompressedDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, int[] docIDs, int count, PointValues.IntersectVisitor visitor, int compressedDim)(package private) voidvisitDocIDs(IndexInput in, long blockFP, PointValues.IntersectVisitor visitor)(package private) voidvisitDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, int[] docIDs, int count, PointValues.IntersectVisitor visitor)voidvisitLeafBlockValues(int nodeID, SimpleTextBKDReader.IntersectState state)Visits all docIDs and packed values in a single leaf block-
Methods inherited from class org.apache.lucene.index.PointValues
estimateDocCount, getDocCount, getMaxPackedValue, getMinPackedValue, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
splitPackedValues
private final byte[] splitPackedValues
-
leafBlockFPs
final long[] leafBlockFPs
-
leafNodeOffset
private final int leafNodeOffset
-
numDims
final int numDims
-
numIndexDims
final int numIndexDims
-
bytesPerDim
final int bytesPerDim
-
bytesPerIndexEntry
final int bytesPerIndexEntry
-
in
final IndexInput in
-
maxPointsInLeafNode
final int maxPointsInLeafNode
-
minPackedValue
final byte[] minPackedValue
-
maxPackedValue
final byte[] maxPackedValue
-
pointCount
final long pointCount
-
docCount
final int docCount
-
version
final int version
-
packedBytesLength
protected final int packedBytesLength
-
packedIndexBytesLength
protected final int packedIndexBytesLength
-
-
Constructor Detail
-
SimpleTextBKDReader
public SimpleTextBKDReader(IndexInput in, int numDims, int numIndexDims, int maxPointsInLeafNode, int bytesPerDim, long[] leafBlockFPs, byte[] splitPackedValues, byte[] minPackedValue, byte[] maxPackedValue, long pointCount, int docCount) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
intersect
public void intersect(PointValues.IntersectVisitor visitor) throws java.io.IOException
Description copied from class:PointValuesFinds all documents and points matching the provided visitor. This method does not enforce live documents, so it's up to the caller to test whether each document is deleted, if necessary.- Specified by:
intersectin classPointValues- Throws:
java.io.IOException
-
addAll
private void addAll(SimpleTextBKDReader.IntersectState state, int nodeID) throws java.io.IOException
Fast path: this is called when the query box fully encompasses all cells under this node.- Throws:
java.io.IOException
-
getIntersectState
public SimpleTextBKDReader.IntersectState getIntersectState(PointValues.IntersectVisitor visitor)
Create a newSimpleTextBKDReader.IntersectState
-
visitLeafBlockValues
public void visitLeafBlockValues(int nodeID, SimpleTextBKDReader.IntersectState state) throws java.io.IOExceptionVisits all docIDs and packed values in a single leaf block- Throws:
java.io.IOException
-
visitDocIDs
void visitDocIDs(IndexInput in, long blockFP, PointValues.IntersectVisitor visitor) throws java.io.IOException
- Throws:
java.io.IOException
-
readDocIDs
int readDocIDs(IndexInput in, long blockFP, int[] docIDs) throws java.io.IOException
- Throws:
java.io.IOException
-
visitDocValues
void visitDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, int[] docIDs, int count, PointValues.IntersectVisitor visitor) throws java.io.IOException- Throws:
java.io.IOException
-
visitCompressedDocValues
private void visitCompressedDocValues(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in, int[] docIDs, int count, PointValues.IntersectVisitor visitor, int compressedDim) throws java.io.IOException- Throws:
java.io.IOException
-
readCompressedDim
private int readCompressedDim(IndexInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
readCommonPrefixes
private void readCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in) throws java.io.IOException- Throws:
java.io.IOException
-
intersect
private void intersect(SimpleTextBKDReader.IntersectState state, int nodeID, byte[] cellMinPacked, byte[] cellMaxPacked) throws java.io.IOException
- Throws:
java.io.IOException
-
estimatePointCount
public long estimatePointCount(PointValues.IntersectVisitor visitor)
Description copied from class:PointValuesEstimate the number of points that would be visited byPointValues.intersect(org.apache.lucene.index.PointValues.IntersectVisitor)with the givenPointValues.IntersectVisitor. This should run many times faster thanPointValues.intersect(IntersectVisitor).- Specified by:
estimatePointCountin classPointValues
-
estimatePointCount
private long estimatePointCount(SimpleTextBKDReader.IntersectState state, int nodeID, byte[] cellMinPacked, byte[] cellMaxPacked)
-
copySplitValue
public void copySplitValue(int nodeID, byte[] splitPackedValue)Copies the split value for this node into the provided byte array
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
getMinPackedValue
public byte[] getMinPackedValue()
Description copied from class:PointValuesReturns minimum value for each dimension, packed, or null ifPointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)is0- Specified by:
getMinPackedValuein classPointValues
-
getMaxPackedValue
public byte[] getMaxPackedValue()
Description copied from class:PointValuesReturns maximum value for each dimension, packed, or null ifPointValues.size(org.apache.lucene.index.IndexReader, java.lang.String)is0- Specified by:
getMaxPackedValuein classPointValues
-
getNumDimensions
public int getNumDimensions()
Description copied from class:PointValuesReturns how many dimensions are represented in the values- Specified by:
getNumDimensionsin classPointValues
-
getNumIndexDimensions
public int getNumIndexDimensions()
Description copied from class:PointValuesReturns how many dimensions are used for the index- Specified by:
getNumIndexDimensionsin classPointValues
-
getBytesPerDimension
public int getBytesPerDimension()
Description copied from class:PointValuesReturns the number of bytes per dimension- Specified by:
getBytesPerDimensionin classPointValues
-
size
public long size()
Description copied from class:PointValuesReturns the total number of indexed points across all documents.- Specified by:
sizein classPointValues
-
getDocCount
public int getDocCount()
Description copied from class:PointValuesReturns the total number of documents that have indexed at least one point.- Specified by:
getDocCountin classPointValues
-
isLeafNode
public boolean isLeafNode(int nodeID)
-
parseInt
private int parseInt(BytesRefBuilder scratch, BytesRef prefix)
-
stripPrefix
private java.lang.String stripPrefix(BytesRefBuilder scratch, BytesRef prefix)
-
startsWith
private boolean startsWith(BytesRefBuilder scratch, BytesRef prefix)
-
readLine
private void readLine(IndexInput in, BytesRefBuilder scratch) throws java.io.IOException
- Throws:
java.io.IOException
-
-