final NumericDoubleValues singleton = FieldData.unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = FieldData.unwrapSingletonBits(values); if (docsWithField == null || missingValue == 0) { return singleton;
final BinaryDocValues singleton = FieldData.unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = FieldData.unwrapSingletonBits(values); if (docsWithField == null) { return singleton;
final BinaryDocValues singleton = FieldData.unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = FieldData.unwrapSingletonBits(values); if (docsWithField == null) { return singleton;
final NumericDoubleValues singleton = FieldData.unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = FieldData.unwrapSingletonBits(values); if (docsWithField == null || missingValue == 0) { return singleton;
final GeoPointValues singleValues = FieldData.unwrapSingleton(geoPointValues); if (singleValues != null && distances.length == 1) { final Bits docsWithField = FieldData.unwrapSingletonBits(geoPointValues); return FieldData.singleton(new NumericDoubleValues() {
final GeoPointValues singleValues = FieldData.unwrapSingleton(geoPointValues); if (singleValues != null && fromPoints.length == 1) { final Bits docsWithField = FieldData.unwrapSingletonBits(geoPointValues); return FieldData.singleton(new NumericDoubleValues() {
/** * Wrap the provided {@link SortedNumericDoubleValues} instance to cast all values to longs. */ public static SortedNumericDocValues castToLong(final SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = unwrapSingletonBits(values); return DocValues.singleton(new LongCastedValues(singleton), docsWithField); } else { return new SortedLongCastedValues(values); } }
/** * Wrap the provided {@link SortedNumericDoubleValues} instance to cast all values to longs. */ public static SortedNumericDocValues castToLong(final SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = unwrapSingletonBits(values); return DocValues.singleton(new LongCastedValues(singleton), docsWithField); } else { return new SortedLongCastedValues(values); } }
@Override public Bits docsWithValue(LeafReaderContext context) throws IOException { final SortedBinaryDocValues bytes = bytesValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(bytes) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(bytes); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(bytes, context.reader().maxDoc()); } }
@Override public Bits docsWithValue(LeafReaderContext context) { final MultiGeoPointValues geoPoints = geoPointValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(geoPoints) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(geoPoints); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(geoPoints, context.reader().maxDoc()); } }
@Override public Bits docsWithValue(LeafReaderContext context) throws IOException { final SortedBinaryDocValues bytes = bytesValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(bytes) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(bytes); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(bytes, context.reader().maxDoc()); } }
@Override public Bits docsWithValue(LeafReaderContext context) { final MultiGeoPointValues geoPoints = geoPointValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(geoPoints) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(geoPoints); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(geoPoints, context.reader().maxDoc()); } }
/** * Given a {@link SortedNumericDoubleValues}, return a {@link SortedNumericDocValues} * instance that will translate double values to sortable long bits using * {@link NumericUtils#doubleToSortableLong(double)}. */ public static SortedNumericDocValues toSortableLongBits(SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final NumericDocValues longBits; if (singleton instanceof SortableLongBitsToNumericDoubleValues) { longBits = ((SortableLongBitsToNumericDoubleValues) singleton).getLongValues(); } else { longBits = new SortableLongBitsNumericDocValues(singleton); } final Bits docsWithField = unwrapSingletonBits(values); return DocValues.singleton(longBits, docsWithField); } else { if (values instanceof SortableLongBitsToSortedNumericDoubleValues) { return ((SortableLongBitsToSortedNumericDoubleValues) values).getLongValues(); } else { return new SortableLongBitsSortedNumericDocValues(values); } } }
/** * Given a {@link SortedNumericDoubleValues}, return a {@link SortedNumericDocValues} * instance that will translate double values to sortable long bits using * {@link NumericUtils#doubleToSortableLong(double)}. */ public static SortedNumericDocValues toSortableLongBits(SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final NumericDocValues longBits; if (singleton instanceof SortableLongBitsToNumericDoubleValues) { longBits = ((SortableLongBitsToNumericDoubleValues) singleton).getLongValues(); } else { longBits = new SortableLongBitsNumericDocValues(singleton); } final Bits docsWithField = unwrapSingletonBits(values); return DocValues.singleton(longBits, docsWithField); } else { if (values instanceof SortableLongBitsToSortedNumericDoubleValues) { return ((SortableLongBitsToSortedNumericDoubleValues) values).getLongValues(); } else { return new SortableLongBitsSortedNumericDocValues(values); } } }
@Override public Bits docsWithValue(LeafReaderContext context) throws IOException { if (isFloatingPoint()) { final SortedNumericDoubleValues values = doubleValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(values) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(values); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(values, context.reader().maxDoc()); } } else { final SortedNumericDocValues values = longValues(context); if (DocValues.unwrapSingleton(values) != null) { return DocValues.unwrapSingletonBits(values); } else { return DocValues.docsWithValue(values, context.reader().maxDoc()); } } }
@Override public Bits docsWithValue(LeafReaderContext context) throws IOException { if (isFloatingPoint()) { final SortedNumericDoubleValues values = doubleValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(values) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(values); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(values, context.reader().maxDoc()); } } else { final SortedNumericDocValues values = longValues(context); if (DocValues.unwrapSingleton(values) != null) { return DocValues.unwrapSingletonBits(values); } else { return DocValues.docsWithValue(values, context.reader().maxDoc()); } } }