void reset(int numTerms, int flags, int[] prefixLengths, int[] suffixLengths, int[] termFreqs, int[] positionIndex, int[] positions, int[] startOffsets, int[] lengths, int[] payloadIndex, BytesRef payloads, ByteArrayDataInput in) { this.numTerms = numTerms; this.prefixLengths = prefixLengths; this.suffixLengths = suffixLengths; this.termFreqs = termFreqs; this.positionIndex = positionIndex; this.positions = positions; this.startOffsets = startOffsets; this.lengths = lengths; this.payloadIndex = payloadIndex; this.payloads = payloads; this.in = in; startPos = in.getPosition(); reset(); }
public void setFloorData(ByteArrayDataInput in, BytesRef source) { final int numBytes = source.length - (in.getPosition() - source.offset); if (numBytes > floorData.length) { floorData = new byte[ArrayUtil.oversize(numBytes, 1)]; } System.arraycopy(source.bytes, source.offset+in.getPosition(), floorData, 0, numBytes); floorDataReader.reset(floorData, 0, numBytes); numFollowFloorBlocks = floorDataReader.readVInt(); nextFloorLabel = floorDataReader.readByte() & 0xff; //if (DEBUG) { //System.out.println(" setFloorData fpOrig=" + fpOrig + " bytes=" + new BytesRef(source.bytes, source.offset + in.getPosition(), numBytes) + " numFollowFloorBlocks=" + numFollowFloorBlocks + " nextFloorLabel=" + toHex(nextFloorLabel)); //} }
public void nextLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); }
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; } }
public void nextLeaf() { //if (DEBUG) System.out.println(" frame.next ord=" + ord + " nextEnt=" + nextEnt + " entCount=" + entCount); assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); ste.term.setLength(prefix + suffix); ste.term.grow(ste.term.length()); suffixesReader.readBytes(ste.term.bytes(), prefix, suffix); ste.termExists = true; }
leftNodePositions[level] = in.getPosition(); rightNodePositions[level] = leftNodePositions[level] + leftNumBytes;
final int savePos = currentFrame.suffixesReader.getPosition(); final int saveStartBytePos = currentFrame.startBytePos; final int saveSuffix = currentFrame.suffix;
final int code = suffixesReader.readVInt(); suffix = code >>> 1; startBytePos = suffixesReader.getPosition(); ste.term.setLength(prefix + suffix); ste.term.grow(ste.term.length());
startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix);
scratch.bytes = new byte[16]; while (in.getPosition() != updates.length) { int code = in.readVInt(); int docIDUpto = in.readVInt();
startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); ste.termExists = (code & 1) == 0;
@Override public BytesRef nextValue() throws IOException { scratch.length = in.readVInt(); scratch.offset = in.getPosition(); in.setPosition(scratch.offset + scratch.length); return scratch; }
scratchA.length = readerA.readShort(); scratchA.bytes = a.bytes; scratchA.offset = readerA.getPosition(); scratchB.offset = readerB.getPosition(); scratchA.offset = readerA.getPosition(); scratchB.length = readerB.readShort(); scratchB.offset = readerB.getPosition(); } else { scratchA.offset = readerA.getPosition(); scratchA.length = a.length - scratchA.offset; scratchB.offset = readerB.getPosition(); scratchB.length = b.length - scratchB.offset;
static ParsedScrollId parseScrollId(String scrollId) { try { byte[] bytes = Base64.getUrlDecoder().decode(scrollId); ByteArrayDataInput in = new ByteArrayDataInput(bytes); String type = in.readString(); ScrollIdForNode[] context = new ScrollIdForNode[in.readVInt()]; for (int i = 0; i < context.length; ++i) { long id = in.readLong(); String target = in.readString(); String clusterAlias; final int index = target.indexOf(RemoteClusterAware.REMOTE_CLUSTER_INDEX_SEPARATOR); if (index == -1) { clusterAlias = null; } else { clusterAlias = target.substring(0, index); target = target.substring(index+1); } context[i] = new ScrollIdForNode(clusterAlias, target, id); } if (in.getPosition() != bytes.length) { throw new IllegalArgumentException("Not all bytes were read"); } return new ParsedScrollId(scrollId, type, context); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse scroll id", e); } }
if (hasPayloads) { surface.length = input.readShort(); surface.offset = input.getPosition(); } else { surface.offset = input.getPosition(); surface.length = bytes.length - surface.offset; builder.add(scratchInts.get(), outputs.newPair(cost, BytesRef.deepCopyOf(surface))); } else { int payloadOffset = input.getPosition() + surface.length; int payloadLength = bytes.length - payloadOffset; BytesRef br = new BytesRef(surface.length + 1 + payloadLength);
public void nextLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); }
public boolean nextLeaf() { //if (DEBUG) System.out.println(" frame.next ord=" + ord + " nextEnt=" + nextEnt + " entCount=" + entCount); assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); return false; }
public void nextLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); }
public void nextLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; suffix = suffixesReader.readVInt(); startBytePos = suffixesReader.getPosition(); suffixesReader.skipBytes(suffix); }
@Override public BytesRef nextValue() throws IOException { scratch.length = in.readVInt(); scratch.offset = in.getPosition(); in.setPosition(scratch.offset + scratch.length); return scratch; }