@Override public BytesRef nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@Override protected BytesRef pick(SortedBinaryDocValues values) throws IOException { return values.nextValue(); }
@Override public long nextValue() throws IOException { final BytesRef bytes = values.nextValue(); org.elasticsearch.common.hash.MurmurHash3.hash128(bytes.bytes, bytes.offset, bytes.length, 0, hash); return hash.h1; } }
@Override public long longValue() throws IOException { final BytesRef bytes = values.nextValue(); return bytes.hashCode(); } };
@Override public long longValue() throws IOException { final BytesRef bytes = values.nextValue(); long bucketOrdinal = bucketOrds.add(bytes); if (bucketOrdinal < 0) { // already seen bucketOrdinal = -1 - bucketOrdinal; } return bucketOrdinal; } };
@Override public BytesRef nextValue() throws IOException { BytesRef nextID = idValues.nextValue(); scratch.copyBytes(prefix); scratch.append(nextID); return scratch.get(); }
@Override public void collect(int doc, long bucket) throws IOException { if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); for (int i = 0, lo = 0; i < valuesCount; ++i) { final BytesRef value = values.nextValue(); lo = collect(doc, value, bucket, lo); } } }
@Override public double score(int docId, float subQueryScore) throws IOException { int hash; if (values == null) { hash = BitMixer.mix(ctx.docBase + docId, saltedSeed); } else if (values.advanceExact(docId)) { hash = StringHelper.murmurhash3_x86_32(values.nextValue(), saltedSeed); } else { // field has no value hash = saltedSeed; } return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public void collect(int doc, long bucket) throws IOException { if (dvs.advanceExact(doc)) { int num = dvs.docValueCount(); for (int i = 0; i < num; i++) { currentValue = dvs.nextValue(); next.collect(doc, bucket); } } else if (missingBucket) { currentValue = null; next.collect(doc, bucket); } } };
@Override public void setNextDocId(int docId) throws IOException { if (in.advanceExact(docId)) { resize(in.docValueCount()); for (int i = 0; i < count; i++) { // We need to make a copy here, because BytesBinaryDVAtomicFieldData's SortedBinaryDocValues // implementation reuses the returned BytesRef. Otherwise we would end up with the same BytesRef // instance for all slots in the values array. values[i].copyBytes(in.nextValue()); } } else { resize(0); } }
@Override public boolean advanceExact(int doc) throws IOException { if (bytesValues.advanceExact(doc)) { count = bytesValues.docValueCount(); grow(); for (int i = 0; i < count; ++i) { final BytesRef value = bytesValues.nextValue(); script.setNextAggregationValue(value.utf8ToString()); Object run = script.run(); CollectionUtils.ensureNoSelfReferences(run); values[i].copyChars(run.toString()); } sort(); return true; } else { count = 0; grow(); return false; } } }
@Override public BytesRef nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@Override public BytesRef nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
if (binaryValues.advanceExact(subDocId)) { for (int i = 0, count = binaryValues.docValueCount(); i < count; ++i) { values.add(format.format(binaryValues.nextValue()));
@Override public void collect(int doc, long bucket) throws IOException { assert bucket == 0; if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); // SortedBinaryDocValues don't guarantee uniqueness so we // need to take care of dups previous.clear(); for (int i = 0; i < valuesCount; ++i) { final BytesRef bytes = values.nextValue(); if (includeExclude != null && !includeExclude.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } long bucketOrdinal = bucketOrds.add(bytes); if (bucketOrdinal < 0) { // already seen bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, doc, bucketOrdinal); } else { collectBucket(sub, doc, bucketOrdinal); } previous.copyBytes(bytes); } } } };
@Override public long longValue() throws IOException { final BytesRef bytes = values.nextValue(); return bytes.hashCode(); } };
final int valueCount = values.docValueCount(); for (int i = 0; i < valueCount; ++i) { final BytesRef term = values.nextValue(); if (includeExclude == null || includeExclude.accept(term)) { bucketOrds.add(term);
@Override public void collect(int doc, long bucket) throws IOException { if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); for (int i = 0, lo = 0; i < valuesCount; ++i) { final BytesRef value = values.nextValue(); lo = collect(doc, value, bucket, lo); } } }