boolean singleValuePerDoc = values.size() == values.getDocCount(); try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(), writeState.directory, writeState.segmentInfo.name, final long fp = writer.writeField(dataOut, fieldInfo.name, (MutablePointValues) values); if (fp != -1) { indexFPs.put(fieldInfo.name, fp); if (writer.getPointCount() > 0) { indexFPs.put(fieldInfo.name, writer.finish(dataOut));
public void visit(int docID, byte[] packedValue) throws IOException { writer.add(packedValue, docID); }
assert nodeID == 1 || delta > 0: "nodeID=" + nodeID; writeBuffer.writeVLong(delta); return appendBlock(writeBuffer, blocks); long leftBlockFP; if (isLeft == false) { leftBlockFP = getLeftMostLeafBlockFP(leafBlockFPs, nodeID); long delta = leftBlockFP - minBlockFP; assert nodeID == 1 || delta > 0 : "expected nodeID=1 or delta > 0; got nodeID=" + nodeID + " and delta=" + delta; int numBytes = appendBlock(writeBuffer, blocks); negativeDeltas[splitDim] = true; int leftNumBytes = recursePackIndex(writeBuffer, leafBlockFPs, splitPackedValues, leftBlockFP, blocks, 2*nodeID, lastSplitValues, negativeDeltas, true); int rightNumBytes = recursePackIndex(writeBuffer, leafBlockFPs, splitPackedValues, leftBlockFP, blocks, 2*nodeID+1, lastSplitValues, negativeDeltas, false);
/** Sliced reference to points in an OfflineSorter.ByteSequencesWriter file. */ private static final class PathSlice { final PointWriter writer; final long start; final long count; public PathSlice(PointWriter writer, long start, long count) { this.writer = writer; this.start = start; this.count = count; } @Override public String toString() { return "PathSlice(start=" + start + " count=" + count + " writer=" + writer + ")"; } }
checkMaxLeafNodeCount(numLeaves); build(1, numLeaves, values, 0, Math.toIntExact(pointCount), out, minPackedValue, maxPackedValue, parentSplits, splitPackedValues, leafBlockFPs, writeIndex(out, Math.toIntExact(countPerLeaf), leafBlockFPs, splitPackedValues); return indexFP;
checkMaxLeafNodeCount(numLeaves); sortedPointWriters[dim] = new PathSlice(sort(dim), 0, pointCount); build(1, numLeaves, sortedPointWriters, ordBitSet, out, minPackedValue, maxPackedValue, writeIndex(out, Math.toIntExact(countPerLeaf), leafBlockFPs, splitPackedValues); return indexFP;
private void writeActualBounds(DataOutput out, int[] commonPrefixLengths, int count, IntFunction<BytesRef> packedValues) throws IOException { for (int dim = 0; dim < numIndexDims; ++dim) { int commonPrefixLength = commonPrefixLengths[dim]; int suffixLength = bytesPerDim - commonPrefixLength; if (suffixLength > 0) { BytesRef[] minMax = computeMinMax(count, packedValues, dim * bytesPerDim + commonPrefixLength, suffixLength); BytesRef min = minMax[0]; BytesRef max = minMax[1]; out.writeBytes(min.bytes, min.offset, min.length); out.writeBytes(max.bytes, max.offset, max.length); } } }
/** Sliced reference to points in an OfflineSorter.ByteSequencesWriter file. */ private static final class PathSlice { final PointWriter writer; final long start; final long count; public PathSlice(PointWriter writer, long start, long count) { this.writer = writer; this.start = start; this.count = count; } @Override public String toString() { return "PathSlice(start=" + start + " count=" + count + " writer=" + writer + ")"; } }
checkMaxLeafNodeCount(numLeaves); sortedPointWriters[dim] = new PathSlice(sort(dim), 0, pointCount); build(1, numLeaves, sortedPointWriters, ordBitSet, out, minPackedValue, maxPackedValue, writeIndex(out, Math.toIntExact(countPerLeaf), leafBlockFPs, splitPackedValues); return indexFP;
checkMaxLeafNodeCount(numLeaves); build(1, numLeaves, values, 0, Math.toIntExact(pointCount), out, minPackedValue, maxPackedValue, parentSplits, splitPackedValues, leafBlockFPs, writeIndex(out, Math.toIntExact(countPerLeaf), leafBlockFPs, splitPackedValues); return indexFP;
private void writeActualBounds(DataOutput out, int[] commonPrefixLengths, int count, IntFunction<BytesRef> packedValues) throws IOException { for (int dim = 0; dim < numIndexDims; ++dim) { int commonPrefixLength = commonPrefixLengths[dim]; int suffixLength = bytesPerDim - commonPrefixLength; if (suffixLength > 0) { BytesRef[] minMax = computeMinMax(count, packedValues, dim * bytesPerDim + commonPrefixLength, suffixLength); BytesRef min = minMax[0]; BytesRef max = minMax[1]; out.writeBytes(min.bytes, min.offset, min.length); out.writeBytes(max.bytes, max.offset, max.length); } } }
boolean singleValuePerDoc = values.size() == values.getDocCount(); try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(), writeState.directory, writeState.segmentInfo.name, final long fp = writer.writeField(dataOut, fieldInfo.name, (MutablePointValues) values); if (fp != -1) { indexFPs.put(fieldInfo.name, fp); if (writer.getPointCount() > 0) { indexFPs.put(fieldInfo.name, writer.finish(dataOut));
assert nodeID == 1 || delta > 0: "nodeID=" + nodeID; writeBuffer.writeVLong(delta); return appendBlock(writeBuffer, blocks); long leftBlockFP; if (isLeft == false) { leftBlockFP = getLeftMostLeafBlockFP(leafBlockFPs, nodeID); long delta = leftBlockFP - minBlockFP; assert nodeID == 1 || delta > 0 : "expected nodeID=1 or delta > 0; got nodeID=" + nodeID + " and delta=" + delta; int numBytes = appendBlock(writeBuffer, blocks); negativeDeltas[splitDim] = true; int leftNumBytes = recursePackIndex(writeBuffer, leafBlockFPs, splitPackedValues, leftBlockFP, blocks, 2*nodeID, lastSplitValues, negativeDeltas, true); int rightNumBytes = recursePackIndex(writeBuffer, leafBlockFPs, splitPackedValues, leftBlockFP, blocks, 2*nodeID+1, lastSplitValues, negativeDeltas, false);
public void visit(int docID, byte[] packedValue) throws IOException { writer.add(packedValue, docID); }