@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
@Override SortedNumericDocValues getValues(LeafReader reader, String field) throws IOException { FieldInfo info = reader.getFieldInfos().fieldInfo(field); if (info == null) { // Queries have some optimizations when one sub scorer returns null rather // than a scorer that does not match any documents return null; } return DocValues.getSortedNumeric(reader, field); } };
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
@Override public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException { LeafReader reader = context.reader(); FieldInfo info = reader.getFieldInfos().fieldInfo(field); if (info != null) { LatLonDocValuesField.checkCompatible(info); } currentDocs = DocValues.getSortedNumeric(reader, field); valuesDocID = -1; return this; }
/** Wraps a {@link SortedNumericDocValues} as a single-valued view if the field is an instance of {@link SortedNumericSortField}, * returns {@link NumericDocValues} for the field otherwise. */ static NumericDocValues getOrWrapNumeric(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedNumericSortField) { SortedNumericSortField sf = (SortedNumericSortField) sortField; return SortedNumericSelector.wrap(DocValues.getSortedNumeric(reader, sf.getField()), sf.getSelector(), sf.getNumericType()); } else { return DocValues.getNumeric(reader, sortField.getField()); } }
@Override public SortedNumericDocValues getLongValues() { try { return DocValues.getSortedNumeric(reader, field); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public SortedNumericDoubleValues getDoubleValues() { try { SortedNumericDocValues raw = DocValues.getSortedNumeric(reader, field); return FieldData.sortableLongBitsToDoubles(raw); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public MultiGeoPointValues getGeoPointValues() { try { final SortedNumericDocValues numericValues = DocValues.getSortedNumeric(reader, fieldName); return new MultiGeoPointValues() {
@Override public SortedNumericDoubleValues getDoubleValues() { try { SortedNumericDocValues raw = DocValues.getSortedNumeric(reader, field); NumericDocValues single = DocValues.unwrapSingleton(raw); if (single != null) { return FieldData.singleton(new SingleFloatValues(single)); } else { return new MultiFloatValues(raw); } } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public SortedNumericDoubleValues getDoubleValues() { try { SortedNumericDocValues raw = DocValues.getSortedNumeric(reader, field); NumericDocValues single = DocValues.unwrapSingleton(raw); if (single != null) { return FieldData.singleton(new SingleHalfFloatValues(single)); } else { return new MultiHalfFloatValues(raw); } } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
final SortedNumericDocValues sorted = DocValues.getSortedNumeric(reader, field); values = DocValues.unwrapSingleton(sorted); if (values == null) {
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final SortedNumericDocValues values = DocValues.getSortedNumeric(context.reader(), getField()); final DocIdSetIterator approximation = DocIdSetIterator.all(context.reader().maxDoc()); final TwoPhaseIterator twoPhase = new TwoPhaseIterator(approximation) { @Override public boolean matches() throws IOException { if (values.advanceExact(approximation.docID())) { for (int i = 0; i < values.docValueCount(); i++) { if (contains(BitMixer.mix(values.nextValue()))) { return true; } } return false; } else { return contains(0); } } @Override public float matchCost() { // BitMixer.mix seems to be about 10 ops return 10; } }; return new ConstantScoreScorer(this, score(), twoPhase); }
DistanceLeafCollector(LeafReaderContext context) throws IOException { final LeafReader atomicReader = context.reader(); this.geoPointValues = DocValues.getSortedNumeric( atomicReader, absoluteFieldPath ); this.docBase = context.docBase; }
@Override protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException { SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field); return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.LONG); }
@Override protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException { SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field); return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.INT); }
@Override protected NumericDocValues getNumericDocValues(Map context, LeafReaderContext readerContext) throws IOException { SortedNumericDocValues sortedDv = DocValues.getSortedNumeric(readerContext.reader(), field); return SortedNumericSelector.wrap(sortedDv, selector, SortField.Type.DOUBLE); }
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
/** Wraps a {@link SortedNumericDocValues} as a single-valued view if the field is an instance of {@link SortedNumericSortField}, * returns {@link NumericDocValues} for the field otherwise. */ static NumericDocValues getOrWrapNumeric(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedNumericSortField) { SortedNumericSortField sf = (SortedNumericSortField) sortField; return SortedNumericSelector.wrap(DocValues.getSortedNumeric(reader, sf.getField()), sf.getSelector(), sf.getNumericType()); } else { return DocValues.getNumeric(reader, sortField.getField()); } }