/** * Appends a copy of the given {@link BytesRef} to this {@link BytesRefArray}. * @param bytes the bytes to append * @return the index of the appended bytes */ @Override public int append(BytesRef bytes) { if (lastElement >= offsets.length) { int oldLen = offsets.length; offsets = ArrayUtil.grow(offsets, offsets.length + 1); bytesUsed.addAndGet((offsets.length - oldLen) * Integer.BYTES); } pool.append(bytes); offsets[lastElement++] = currentOffset; currentOffset += bytes.length; return lastElement-1; }
public void addPackedValue(int docID, BytesRef value) { if (value == null) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": point value must not be null"); } if (value.length != packedBytesLength) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": this field's value has length=" + value.length + " but should be " + (fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes())); } if (docIDs.length == numPoints) { docIDs = ArrayUtil.grow(docIDs, numPoints+1); iwBytesUsed.addAndGet((docIDs.length - numPoints) * Integer.BYTES); } bytes.append(value); docIDs[numPoints] = docID; if (docID != lastDocID) { numDocs++; lastDocID = docID; } numPoints++; }
/** * Appends a copy of the given {@link BytesRef} to this {@link BytesRefArray}. * @param bytes the bytes to append * @return the index of the appended bytes */ public int append(BytesRef bytes) { if (lastElement >= offsets.length) { int oldLen = offsets.length; offsets = ArrayUtil.grow(offsets, offsets.length + 1); bytesUsed.addAndGet((offsets.length - oldLen) * RamUsageEstimator.NUM_BYTES_INT); } pool.append(bytes); offsets[lastElement++] = currentOffset; currentOffset += bytes.length; return lastElement-1; }
/** * Appends a copy of the given {@link BytesRef} to this {@link BytesRefArray}. * @param bytes the bytes to append * @return the index of the appended bytes */ @Override public int append(BytesRef bytes) { if (lastElement >= offsets.length) { int oldLen = offsets.length; offsets = ArrayUtil.grow(offsets, offsets.length + 1); bytesUsed.addAndGet((offsets.length - oldLen) * Integer.BYTES); } pool.append(bytes); offsets[lastElement++] = currentOffset; currentOffset += bytes.length; return lastElement-1; }
/** * Appends a copy of the given {@link BytesRef} to this {@link BytesRefArray}. * @param bytes the bytes to append * @return the index of the appended bytes */ public int append(BytesRef bytes) { if (lastElement >= offsets.length) { int oldLen = offsets.length; offsets = ArrayUtil.grow(offsets, offsets.length + 1); bytesUsed.addAndGet((offsets.length - oldLen) * RamUsageEstimator.NUM_BYTES_INT); } pool.append(bytes); offsets[lastElement++] = currentOffset; currentOffset += bytes.length; return lastElement-1; }
public void addPackedValue(int docID, BytesRef value) { if (value == null) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": point value must not be null"); } if (value.length != packedBytesLength) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": this field's value has length=" + value.length + " but should be " + (fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes())); } if (docIDs.length == numPoints) { docIDs = ArrayUtil.grow(docIDs, numPoints+1); iwBytesUsed.addAndGet((docIDs.length - numPoints) * Integer.BYTES); } bytes.append(value); docIDs[numPoints] = docID; if (docID != lastDocID) { numDocs++; lastDocID = docID; } numPoints++; }