@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 boolean advanceExact(int doc) throws IOException { if (values.advanceExact(doc)) { count = values.docValueCount(); } else { count = 0; } // always return true because we want to return a value even if // the document does not have a value return true; }
@Override protected BytesRef pick(SortedBinaryDocValues values) throws IOException { int count = values.docValueCount(); for (int i = 0; i < count - 1; ++i) { values.nextValue(); } return values.nextValue(); }
@Override protected BytesRef pick(SortedBinaryDocValues values, BytesRef missingValue, int doc) { values.setDocument(doc); final int count = values.count(); return count > 0 ? values.valueAt(count - 1) : missingValue; }
@Override public boolean get(int index) { dv.setDocument(index); return dv.count() != 0; }
@Override public BytesRef get(int index) { return values.valueAt(index); }
@Override public double score(int docId, float subQueryScore) { uidByteData.setDocument(docId); int hash = StringHelper.murmurhash3_x86_32(uidByteData.valueAt(0), saltedSeed); return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public int size() { return values.count(); } }
@Override public void setNextDocId(int docId) { values.setDocument(docId); }
@Override public BytesRef nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@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 boolean advanceExact(int doc) throws IOException { return values.advanceExact(doc); } };
@Override public int count() { return values.docValueCount(); }
@Override protected BytesRef pick(SortedBinaryDocValues values, BytesRef missingValue, int doc) { values.setDocument(doc); final int count = values.count(); return count > 0 ? values.valueAt(count - 1) : missingValue; }
@Override public void setDocument(int docId) { values.setDocument(docId); count = values.count(); }
@Override public BytesRef next() { return values.valueAt(this.count++); }
@Override public double score(int docId, float subQueryScore) { uidByteData.setDocument(docId); int hash = StringHelper.murmurhash3_x86_32(uidByteData.valueAt(0), saltedSeed); return (hash & 0x00FFFFFF) / (float)(1 << 24); // only use the lower 24 bits to construct a float from 0.0-1.0 }
@Override public boolean advanceExact(int target) throws IOException { docID = target; if (values.advanceExact(target)) { if (values.docValueCount() > 1) { throw new IllegalArgumentException( "Sample diversifying key must be a single valued-field"); } return true; } else { return false; } }