parent
e3d3f6b1f1
commit
3bb6a4dea6
|
@ -70,7 +70,7 @@ public class AggregationContext {
|
|||
} else if (config.valueSourceType() == ValuesSourceType.GEOPOINT) {
|
||||
vs = (VS) ValuesSource.GeoPoint.EMPTY;
|
||||
} else if (config.valueSourceType() == ValuesSourceType.ANY || config.valueSourceType() == ValuesSourceType.BYTES) {
|
||||
vs = (VS) ValuesSource.Bytes.EMPTY;
|
||||
vs = (VS) ValuesSource.Bytes.WithOrdinals.EMPTY;
|
||||
} else {
|
||||
throw new SearchParseException(searchContext, "Can't deal with unmapped ValuesSource type "
|
||||
+ config.valueSourceType(), null);
|
||||
|
|
|
@ -69,25 +69,6 @@ public abstract class ValuesSource {
|
|||
|
||||
public abstract static class Bytes extends ValuesSource {
|
||||
|
||||
public static final WithOrdinals EMPTY = new WithOrdinals() {
|
||||
|
||||
@Override
|
||||
public RandomAccessOrds ordinalsValues(LeafReaderContext context) {
|
||||
return DocValues.emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomAccessOrds globalOrdinalsValues(LeafReaderContext context) {
|
||||
return DocValues.emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException {
|
||||
return org.elasticsearch.index.fielddata.FieldData.emptySortedBinary(context.reader().maxDoc());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public Bits docsWithValue(LeafReaderContext context) throws IOException {
|
||||
final SortedBinaryDocValues bytes = bytesValues(context);
|
||||
|
@ -100,6 +81,25 @@ public abstract class ValuesSource {
|
|||
|
||||
public abstract static class WithOrdinals extends Bytes {
|
||||
|
||||
public static final WithOrdinals EMPTY = new WithOrdinals() {
|
||||
|
||||
@Override
|
||||
public RandomAccessOrds ordinalsValues(LeafReaderContext context) {
|
||||
return DocValues.emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomAccessOrds globalOrdinalsValues(LeafReaderContext context) {
|
||||
return DocValues.emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException {
|
||||
return org.elasticsearch.index.fielddata.FieldData.emptySortedBinary(context.reader().maxDoc());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public Bits docsWithValue(LeafReaderContext context) {
|
||||
final RandomAccessOrds ordinals = ordinalsValues(context);
|
||||
|
|
Loading…
Reference in New Issue