@Override public SortedBinaryDocValues getBytesValues() { SortedBinaryDocValues inValues = in.getBytesValues(); return new SortedBinaryDocValues() { @Override public BytesRef nextValue() throws IOException { BytesRef encoded = inValues.nextValue(); return new BytesRef(Uid.decodeId( Arrays.copyOfRange(encoded.bytes, encoded.offset, encoded.offset + encoded.length))); } @Override public int docValueCount() { final int count = inValues.docValueCount(); // If the count is not 1 then the impl is not correct as the binary representation // does not preserve order. But id fields only have one value per doc so we are good. assert count == 1; return inValues.docValueCount(); } @Override public boolean advanceExact(int doc) throws IOException { return inValues.advanceExact(doc); } }; } };
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); } }
protected SortedBinaryDocValues getValues(LeafReaderContext context) throws IOException { return indexFieldData.load(context).getBytesValues(); }
@Override public SortedBinaryDocValues getBytesValues() { SortedBinaryDocValues idValues = idFieldData.getBytesValues(); return new SortedBinaryDocValues() { private final BytesRefBuilder scratch = new BytesRefBuilder(); @Override public boolean advanceExact(int doc) throws IOException { return idValues.advanceExact(doc); } @Override public int docValueCount() { return idValues.docValueCount(); } @Override public BytesRef nextValue() throws IOException { BytesRef nextID = idValues.nextValue(); scratch.copyBytes(prefix); scratch.append(nextID); return scratch.get(); } }; }
if (fieldData != null) { AtomicFieldData leafData = fieldData.load(ctx); values = leafData.getBytesValues(); if (values == null) throw new NullPointerException("failed to get fielddata"); } else {
binaryValues = data.getBytesValues();
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); } }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); } }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); } }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); } }
@Override public void setNextReader(final AtomicReaderContext context) throws IOException { _bytesFieldValues = _bytesFieldData.load(context).getBytesValues(); }
protected SortedBinaryDocValues getValues(LeafReaderContext context) throws IOException { return indexFieldData.load(context).getBytesValues(); }
@Override public void setNextReader(final AtomicReaderContext context) throws IOException { super.setNextReader(context); _distinctFieldValues = _distinctFieldData.load(context).getBytesValues(); _sliceFieldValues = _sliceFieldData.load(context).getBytesValues(); }
@Override public void setNextReader(AtomicReaderContext context) throws IOException { reader = context.reader(); idValues = idFieldData.load(context).getBytesValues(); }
@Override public void setNextReader(final AtomicReaderContext context) throws IOException { super.setNextReader(context); _sliceFieldValues = _sliceFieldData.load(context).getBytesValues(); }
@Override public void doSetNextReader(LeafReaderContext context) throws IOException { // we use the UID because id might not be indexed values = uidFieldData.load(context).getBytesValues(); aggregatorLeafCollector = aggregatorCollector.getLeafCollector(context); }
@Override protected void doSetNextReader(LeafReaderContext context) throws IOException { reader = context.reader(); uidValues = uidFieldData.load(context).getBytesValues(); }
@Override protected void set(int atomicReaderId, int atomicDocId) { // loading values from field data cache is costly, // therefore we load values from cache only if new atomic reader id if (lastAtomicReaderId != atomicReaderId) { LeafReaderContext leafReader = reader.leaves().get(atomicReaderId); this.values = this.fieldData.load(leafReader).getBytesValues(); } this.values.setDocument(atomicDocId); this.count = 0; this.lastAtomicReaderId = atomicReaderId; }
@Override protected void set(int atomicReaderId, int atomicDocId) { // loading values from field data cache is costly, // therefore we load values from cache only if new atomic reader id if (lastAtomicReaderId != atomicReaderId) { LeafReaderContext leafReader = reader.leaves().get(atomicReaderId); this.values = this.fieldData.load(leafReader).getBytesValues(); } this.values.setDocument(atomicDocId); this.count = 0; this.lastAtomicReaderId = atomicReaderId; }
@Override public void setNextReader(final AtomicReaderContext context) throws IOException { final int currentCount = _entries.size(); if(currentCount > _maxPerShard) return; // Heuristic: only load the values with hashes if we're in exhaustive // mode and we aren't coming close to hitting our per-shard limit. // If either of these conditions are false, load the data without // hashes, and they'll get calculated on the fly anyway. _values = (_exhaustive && currentCount * 1.1 < _maxPerShard) ? _indexFieldData.load(context).getHashedBytesValues() : _indexFieldData.load(context).getBytesValues(); }