void reset() { term.length = 0; in.setPosition(startPos); ord = -1; }
@Override public void pushRight() { int nodePosition = rightNodePositions[level]; super.pushRight(); System.arraycopy(negativeDeltas, (level-1)*numIndexDims, negativeDeltas, level*numIndexDims, numIndexDims); assert splitDim != -1; negativeDeltas[level*numIndexDims+splitDim] = false; in.setPosition(nodePosition); readNodeData(false); }
@Override public void pushLeft() { int nodePosition = leftNodePositions[level]; super.pushLeft(); System.arraycopy(negativeDeltas, (level-1)*numIndexDims, negativeDeltas, level*numIndexDims, numIndexDims); assert splitDim != -1; negativeDeltas[level*numIndexDims+splitDim] = true; in.setPosition(nodePosition); readNodeData(true); }
currentFrame.startBytePos = saveStartBytePos; currentFrame.suffix = saveSuffix; currentFrame.suffixesReader.setPosition(savePos); currentFrame.termState.termBlockOrd = saveTermBlockOrd; currentFrame.isAutoPrefixTerm = saveIsAutoPrefixTerm;
@Override public BytesRef nextValue() throws IOException { scratch.length = in.readVInt(); scratch.offset = in.getPosition(); in.setPosition(scratch.offset + scratch.length); return scratch; }
void reset() { term.length = 0; in.setPosition(startPos); ord = -1; }
void reset() { term.length = 0; in.setPosition(startPos); ord = -1; }
void reset() { term.length = 0; in.setPosition(startPos); ord = -1; }
void reset() { term.length = 0; in.setPosition(startPos); ord = -1; }
affixReader.setPosition(8 * affix); char flag = (char) (affixReader.readShort() & 0xffff); affixReader.skipBytes(2); // strip
continue; affixReader.setPosition(8 * prefix); char flag = (char) (affixReader.readShort() & 0xffff); char stripOrd = (char) (affixReader.readShort() & 0xffff); continue; affixReader.setPosition(8 * suffix); char flag = (char) (affixReader.readShort() & 0xffff); char stripOrd = (char) (affixReader.readShort() & 0xffff);
@Override public void pushLeft() { int nodePosition = leftNodePositions[level]; super.pushLeft(); System.arraycopy(negativeDeltas, (level-1)*numIndexDims, negativeDeltas, level*numIndexDims, numIndexDims); assert splitDim != -1; negativeDeltas[level*numIndexDims+splitDim] = true; in.setPosition(nodePosition); readNodeData(true); }
@Override public void pushRight() { int nodePosition = rightNodePositions[level]; super.pushRight(); System.arraycopy(negativeDeltas, (level-1)*numIndexDims, negativeDeltas, level*numIndexDims, numIndexDims); assert splitDim != -1; negativeDeltas[level*numIndexDims+splitDim] = false; in.setPosition(nodePosition); readNodeData(false); }
@Override public BytesRef nextValue() throws IOException { scratch.length = in.readVInt(); scratch.offset = in.getPosition(); in.setPosition(scratch.offset + scratch.length); return scratch; }
/** Let PBF decode metadata */ void decodeMetaData() throws IOException { final int upto = (int)ord % INTERVAL; final int oldBlockOrd = metaBlockOrd; metaBlockOrd = (int)ord / INTERVAL; if (metaBlockOrd != oldBlockOrd) { refillMetadata(); } metaBytesReader.setPosition(bytesStart[upto]); postingsReader.decodeTerm(longs[upto], metaBytesReader, fieldInfo, state, true); }
@Override public BytesRef nextValue() throws IOException { scratch.length = in.readVInt(); scratch.offset = in.getPosition(); in.setPosition(scratch.offset + scratch.length); return scratch; }
/** decodes the contexts at the current position */ protected Set<BytesRef> decodeContexts(BytesRef scratch, ByteArrayDataInput tmpInput) { tmpInput.reset(scratch.bytes); tmpInput.skipBytes(scratch.length - 2); //skip to context set size short ctxSetSize = tmpInput.readShort(); scratch.length -= 2; final Set<BytesRef> contextSet = new HashSet<>(); for (short i = 0; i < ctxSetSize; i++) { tmpInput.setPosition(scratch.length - 2); short curContextLength = tmpInput.readShort(); scratch.length -= 2; tmpInput.setPosition(scratch.length - curContextLength); BytesRef contextSpare = new BytesRef(curContextLength); tmpInput.readBytes(contextSpare.bytes, 0, curContextLength); contextSpare.length = curContextLength; contextSet.add(contextSpare); scratch.length -= curContextLength; } return contextSet; }
/** Load current stats shard */ final void refillStats() throws IOException { final int offset = statsBlockOrd * numSkipInfo; final int statsFP = (int)skipInfo[offset]; statsReader.setPosition(statsFP); for (int i = 0; i < INTERVAL && !statsReader.eof(); i++) { int code = statsReader.readVInt(); if (hasFreqs()) { docFreq[i] = (code >>> 1); if ((code & 1) == 1) { totalTermFreq[i] = docFreq[i]; } else { totalTermFreq[i] = docFreq[i] + statsReader.readVLong(); } } else { docFreq[i] = code; } } }
/** decodes the payload at the current position */ protected BytesRef decodePayload(BytesRef scratch, ByteArrayDataInput tmpInput) { tmpInput.reset(scratch.bytes); tmpInput.skipBytes(scratch.length - 2); // skip to payload size short payloadLength = tmpInput.readShort(); // read payload size tmpInput.setPosition(scratch.length - 2 - payloadLength); // setPosition to start of payload BytesRef payloadScratch = new BytesRef(payloadLength); tmpInput.readBytes(payloadScratch.bytes, 0, payloadLength); // read payload payloadScratch.length = payloadLength; scratch.length -= 2; // payload length info (short) scratch.length -= payloadLength; // payload return payloadScratch; } }
/** Load current metadata shard */ final void refillMetadata() throws IOException { final int offset = metaBlockOrd * numSkipInfo; final int metaLongsFP = (int)skipInfo[offset + 1]; final int metaBytesFP = (int)skipInfo[offset + 2]; metaLongsReader.setPosition(metaLongsFP); for (int j = 0; j < longsSize; j++) { longs[0][j] = skipInfo[offset + 3 + j] + metaLongsReader.readVLong(); } bytesStart[0] = metaBytesFP; bytesLength[0] = (int)metaLongsReader.readVLong(); for (int i = 1; i < INTERVAL && !metaLongsReader.eof(); i++) { for (int j = 0; j < longsSize; j++) { longs[i][j] = longs[i-1][j] + metaLongsReader.readVLong(); } bytesStart[i] = bytesStart[i-1] + bytesLength[i-1]; bytesLength[i] = (int)metaLongsReader.readVLong(); } }