long getMinLeafBlockFP() { if (packedIndex != null) { return new ByteArrayDataInput(packedIndex).readVLong(); } else { long minFP = Long.MAX_VALUE; for(long fp : leafBlockFPs) { minFP = Math.min(minFP, fp); } return minFP; } }
void loadNextFloorBlock() throws IOException { assert numFollowFloorBlocks > 0: "nextFloorLabel=" + nextFloorLabel; do { fp = fpOrig + (floorDataReader.readVLong() >>> 1); numFollowFloorBlocks--; if (numFollowFloorBlocks != 0) { nextFloorLabel = floorDataReader.readByte() & 0xff; } else { nextFloorLabel = 256; } } while (numFollowFloorBlocks != 0 && nextFloorLabel <= transition.min); load(null); }
final long code = floorDataReader.readVLong(); newFP = fpOrig + (code >>> 1); hasTerms = (code & 1) != 0;
public void scanToSubBlock(long subFP) { assert !isLeafBlock; //if (DEBUG) System.out.println(" scanToSubBlock fp=" + fp + " subFP=" + subFP + " entCount=" + entCount + " lastSubFP=" + lastSubFP); //assert nextEnt == 0; if (lastSubFP == subFP) { //if (DEBUG) System.out.println(" already positioned"); return; } assert subFP < fp : "fp=" + fp + " subFP=" + subFP; final long targetSubCode = fp - subFP; //if (DEBUG) System.out.println(" targetSubCode=" + targetSubCode); while(true) { assert nextEnt < entCount; nextEnt++; final int code = suffixesReader.readVInt(); suffixesReader.skipBytes(code >>> 1); if ((code & 1) != 0) { final long subCode = suffixesReader.readVLong(); if (targetSubCode == subCode) { //if (DEBUG) System.out.println(" match!"); lastSubFP = subFP; return; } } else { state.termBlockOrd++; } } }
public boolean nextNonLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; final int code = suffixesReader.readVInt(); suffix = code >>> 1; startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); if ((code & 1) == 0) { // A normal term termState.termBlockOrd++; return false; } else { // A sub-block; make sub-FP absolute: lastSubFP = fp - suffixesReader.readVLong(); return true; } }
SegmentTermsEnumFrame pushFrame(FST.Arc<BytesRef> arc, BytesRef frameData, int length) throws IOException { scratchReader.reset(frameData.bytes, frameData.offset, frameData.length); final long code = scratchReader.readVLong(); final long fpSeek = code >>> BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS; final SegmentTermsEnumFrame f = getFrame(1+currentFrame.ord); f.hasTerms = (code & BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS) != 0; f.hasTermsOrig = f.hasTerms; f.isFloor = (code & BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR) != 0; if (f.isFloor) { f.setFloorData(scratchReader, frameData); } pushFrame(arc, fpSeek, length); return f; }
} else if (isSeekFrame && !f.isFloor) { final ByteArrayDataInput reader = new ByteArrayDataInput(output.bytes, output.offset, output.length); final long codeOrig = reader.readVLong(); final long code = (f.fp << BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) | (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS:0) | (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR:0); if (codeOrig != code) {
leafBlockFPStack[level] += in.readVLong();
rootBlockFP = (new ByteArrayDataInput(rootCode.bytes, rootCode.offset, rootCode.length)).readVLong() >>> BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS;
subCode = suffixesReader.readVLong(); lastSubFP = fp - subCode;
subCode = 0; } else { subCode = suffixesReader.readVLong(); lastSubFP = fp - subCode;
@Override public long nextOrd() { if (input.eof()) { return NO_MORE_ORDS; } else { currentOrd += input.readVLong(); return currentOrd; } }
long getMinLeafBlockFP() { if (packedIndex != null) { return new ByteArrayDataInput(packedIndex).readVLong(); } else { long minFP = Long.MAX_VALUE; for(long fp : leafBlockFPs) { minFP = Math.min(minFP, fp); } return minFP; } }
@Override public long nextOrd() { if (input.eof()) { return NO_MORE_ORDS; } else { currentOrd += input.readVLong(); return currentOrd; } }
void loadNextFloorBlock() throws IOException { assert numFollowFloorBlocks > 0: "nextFloorLabel=" + nextFloorLabel; do { fp = fpOrig + (floorDataReader.readVLong() >>> 1); numFollowFloorBlocks--; if (numFollowFloorBlocks != 0) { nextFloorLabel = floorDataReader.readByte() & 0xff; } else { nextFloorLabel = 256; } } while (numFollowFloorBlocks != 0 && nextFloorLabel <= transition.min); load(null); }
void loadNextFloorBlock() throws IOException { assert numFollowFloorBlocks > 0: "nextFloorLabel=" + nextFloorLabel; do { fp = fpOrig + (floorDataReader.readVLong() >>> 1); numFollowFloorBlocks--; if (numFollowFloorBlocks != 0) { nextFloorLabel = floorDataReader.readByte() & 0xff; } else { nextFloorLabel = 256; } } while (numFollowFloorBlocks != 0 && nextFloorLabel <= transition.min); load(null); }
void loadNextFloorBlock() throws IOException { assert numFollowFloorBlocks > 0: "nextFloorLabel=" + nextFloorLabel; do { fp = fpOrig + (floorDataReader.readVLong() >>> 1); numFollowFloorBlocks--; if (numFollowFloorBlocks != 0) { nextFloorLabel = floorDataReader.readByte() & 0xff; } else { nextFloorLabel = 256; } } while (numFollowFloorBlocks != 0 && nextFloorLabel <= transition.min); load(null); }