@Override public SortedNumericDoubleValues doubleValues(LeafReaderContext context) { return indexFieldData.load(context).getDoubleValues(); } }
@Override public SortedNumericDocValues longValues(LeafReaderContext context) { return indexFieldData.load(context).getLongValues(); }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); }
protected SortedNumericDoubleValues getValues(LeafReaderContext context) throws IOException { return indexFieldData.load(context).getDoubleValues(); }
@Override public LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException { SortedNumericDocValues values = field.load(ctx).getLongValues(); return new LongValues() { long current = -1; @Override public long longValue() throws IOException { return current; } @Override public boolean advanceExact(int doc) throws IOException { boolean hasValue = values.advanceExact(doc); if (hasValue) { assert values.docValueCount() == 1; current = values.nextValue(); return true; } else { return false; } } }; }
@Override protected String getDistanceString(LeafReaderContext ctx, int docId) throws IOException { StringBuilder values = new StringBuilder(mode.name()); values.append("["); final SortedNumericDoubleValues doubleValues = fieldData.load(ctx).getDoubleValues(); if (doubleValues.advanceExact(docId)) { final int num = doubleValues.docValueCount(); for (int i = 0; i < num; i++) { double value = doubleValues.nextValue(); values.append("Math.max(Math.abs("); values.append(value).append("(=doc value) - "); values.append(origin).append("(=origin))) - "); values.append(offset).append("(=offset), 0)"); if (i != num - 1) { values.append(", "); } } } else { values.append("0.0"); } values.append("]"); return values.toString(); }
values = FieldData.emptySortedNumericDoubles(); } else { values = this.indexFieldData.load(ctx).getDoubleValues();
@Override protected NumericDoubleValues distance(LeafReaderContext context) { final SortedNumericDoubleValues doubleValues = fieldData.load(context).getDoubleValues(); return FieldData.replaceMissing(mode.select(new SortingNumericDoubleValues() { @Override public boolean advanceExact(int docId) throws IOException { if (doubleValues.advanceExact(docId)) { int n = doubleValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { values[i] = Math.max(0.0d, Math.abs(doubleValues.nextValue() - origin) - offset); } sort(); return true; } else { return false; } } }), 0); }
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { final SortedNumericDocValues values = indexFieldData.load(context).getLongValues(); final NumericDocValues selectedValues; if (nested == null) { selectedValues = FieldData.replaceMissing(sortMode.select(values), dMissingValue); } else { final BitSet rootDocs = nested.rootDocs(context); final DocIdSetIterator innerDocs = nested.innerDocs(context); final int maxChildren = nested.getNestedSort() != null ? nested.getNestedSort().getMaxChildren() : Integer.MAX_VALUE; selectedValues = sortMode.select(values, dMissingValue, rootDocs, innerDocs, context.reader().maxDoc(), maxChildren); } return selectedValues; }
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { final SortedNumericDoubleValues values = indexFieldData.load(context).getDoubleValues(); final NumericDoubleValues selectedValues; if (nested == null) { selectedValues = FieldData.replaceMissing(sortMode.select(values), dMissingValue); } else { final BitSet rootDocs = nested.rootDocs(context); final DocIdSetIterator innerDocs = nested.innerDocs(context); final int maxChildren = nested.getNestedSort() != null ? nested.getNestedSort().getMaxChildren() : Integer.MAX_VALUE; selectedValues = sortMode.select(values, dMissingValue, rootDocs, innerDocs, context.reader().maxDoc(), maxChildren); } return selectedValues.getRawFloatValues(); } };
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) { return indexFieldData.load(context).getBytesValues(); }
@Override public SortedNumericDocValues longValues(LeafReaderContext context) { return indexFieldData.load(context).getLongValues(); }
@Override public SortedNumericDoubleValues doubleValues(LeafReaderContext context) { return indexFieldData.load(context).getDoubleValues(); } }
@Override public SortedNumericDoubleValues doubleValues(LeafReaderContext context) { return indexFieldData.load(context).getDoubleValues(); } }
@Override public SortedNumericDocValues longValues(LeafReaderContext context) { return indexFieldData.load(context).getLongValues(); }
@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).getLongValues(); } 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 = ((IndexNumericFieldData) this.fieldData).load(leafReader).getLongValues(); } this.values.setDocument(atomicDocId); this.count = 0; this.lastAtomicReaderId = atomicReaderId; }
final IndexNumericFieldData fieldData = context.getForField(ft); for (LeafReaderContext ctx : reader.leaves()) { AtomicNumericFieldData leafFD = fieldData.load(ctx); SortedNumericDocValues values = leafFD.getLongValues(); if (values.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {