mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Simplify generics (by Ignacio)
Co-authored-by: Ignacio Vera <ivera@apache.org>
This commit is contained in:
parent
cd5a740a2e
commit
050df953df
21 changed files with 64 additions and 80 deletions
|
@ -11,8 +11,8 @@ package org.elasticsearch.script.expression;
|
|||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.search.DoubleValues;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.LeafPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.plain.LeafGeoPointFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -27,8 +27,8 @@ final class GeoEmptyValueSource extends FieldDataBasedDoubleValuesSource {
|
|||
|
||||
@Override
|
||||
public DoubleValues getValues(LeafReaderContext leaf, DoubleValues scores) {
|
||||
LeafPointFieldData<?> leafData = (LeafPointFieldData<?>) fieldData.load(leaf);
|
||||
final MultiPointValues<?> values = leafData.getPointValues();
|
||||
LeafGeoPointFieldData leafData = (LeafGeoPointFieldData) fieldData.load(leaf);
|
||||
final MultiGeoPointValues values = leafData.getPointValues(); // shade
|
||||
return new DoubleValues() {
|
||||
@Override
|
||||
public double doubleValue() {
|
||||
|
|
|
@ -10,10 +10,9 @@ package org.elasticsearch.script.expression;
|
|||
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.search.DoubleValues;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.plain.AbstractLeafGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.plain.LeafGeoPointFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -28,8 +27,8 @@ final class GeoLatitudeValueSource extends FieldDataBasedDoubleValuesSource {
|
|||
|
||||
@Override
|
||||
public DoubleValues getValues(LeafReaderContext leaf, DoubleValues scores) {
|
||||
AbstractLeafGeoPointFieldData leafData = (AbstractLeafGeoPointFieldData) fieldData.load(leaf);
|
||||
final MultiPointValues<GeoPoint> values = leafData.getPointValues();
|
||||
LeafGeoPointFieldData leafData = (LeafGeoPointFieldData) fieldData.load(leaf);
|
||||
final MultiGeoPointValues values = leafData.getPointValues();
|
||||
return new DoubleValues() {
|
||||
@Override
|
||||
public double doubleValue() throws IOException {
|
||||
|
|
|
@ -10,10 +10,9 @@ package org.elasticsearch.script.expression;
|
|||
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.search.DoubleValues;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.plain.AbstractLeafGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.plain.LeafGeoPointFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -28,8 +27,8 @@ final class GeoLongitudeValueSource extends FieldDataBasedDoubleValuesSource {
|
|||
|
||||
@Override
|
||||
public DoubleValues getValues(LeafReaderContext leaf, DoubleValues scores) {
|
||||
AbstractLeafGeoPointFieldData leafData = (AbstractLeafGeoPointFieldData) fieldData.load(leaf);
|
||||
final MultiPointValues<GeoPoint> values = leafData.getPointValues();
|
||||
LeafGeoPointFieldData leafData = (LeafGeoPointFieldData) fieldData.load(leaf);
|
||||
final MultiGeoPointValues values = leafData.getPointValues();
|
||||
return new DoubleValues() {
|
||||
@Override
|
||||
public double doubleValue() throws IOException {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
|||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.index.fielddata.FieldData;
|
||||
import org.elasticsearch.index.fielddata.GeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.NumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.SortingNumericDoubleValues;
|
||||
|
@ -522,10 +522,10 @@ public class GeoUtils {
|
|||
public static SortedNumericDoubleValues distanceValues(
|
||||
final GeoDistance distance,
|
||||
final DistanceUnit unit,
|
||||
final MultiPointValues<GeoPoint> geoPointValues,
|
||||
final MultiGeoPointValues geoPointValues,
|
||||
final GeoPoint... fromPoints
|
||||
) {
|
||||
final GeoPointValues singleValues = (GeoPointValues) FieldData.unwrapSingleton(geoPointValues);
|
||||
final GeoPointValues singleValues = FieldData.unwrapSingleton(geoPointValues);
|
||||
if (singleValues != null && fromPoints.length == 1) {
|
||||
return FieldData.singleton(new NumericDoubleValues() {
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public enum FieldData {
|
|||
* Returns a single-valued view of the {@link MultiGeoPointValues},
|
||||
* if the wrapped {@link SortedNumericDocValues} is a singleton.
|
||||
*/
|
||||
public static PointValues<?> unwrapSingleton(MultiPointValues<? extends ElasticPoint> values) {
|
||||
public static GeoPointValues unwrapSingleton(MultiGeoPointValues values) {
|
||||
return values.getPointValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,8 @@ package org.elasticsearch.index.fielddata;
|
|||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.SortedNumericDocValues;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
import org.elasticsearch.index.fielddata.plain.AbstractLeafGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.plain.LeafGeoPointFieldData;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
import org.elasticsearch.script.GeoPointFieldScript;
|
||||
import org.elasticsearch.script.field.ToScriptFieldFactory;
|
||||
|
@ -24,16 +23,16 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
|||
import org.elasticsearch.search.sort.BucketedSort;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
|
||||
public class GeoPointScriptFieldData implements IndexGeoPointFieldData {
|
||||
public final class GeoPointScriptFieldData implements IndexGeoPointFieldData {
|
||||
public static class Builder implements IndexFieldData.Builder {
|
||||
private final String name;
|
||||
private final GeoPointFieldScript.LeafFactory leafFactory;
|
||||
private final ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory;
|
||||
private final ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory;
|
||||
|
||||
public Builder(
|
||||
String name,
|
||||
GeoPointFieldScript.LeafFactory leafFactory,
|
||||
ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory
|
||||
ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory
|
||||
) {
|
||||
this.name = name;
|
||||
this.leafFactory = leafFactory;
|
||||
|
@ -48,12 +47,12 @@ public class GeoPointScriptFieldData implements IndexGeoPointFieldData {
|
|||
|
||||
private final GeoPointFieldScript.LeafFactory leafFactory;
|
||||
private final String name;
|
||||
private final ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory;
|
||||
private final ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory;
|
||||
|
||||
private GeoPointScriptFieldData(
|
||||
String fieldName,
|
||||
GeoPointFieldScript.LeafFactory leafFactory,
|
||||
ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory
|
||||
ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory
|
||||
) {
|
||||
this.name = fieldName;
|
||||
this.leafFactory = leafFactory;
|
||||
|
@ -90,9 +89,9 @@ public class GeoPointScriptFieldData implements IndexGeoPointFieldData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LeafPointFieldData<GeoPoint> load(LeafReaderContext context) {
|
||||
public LeafPointFieldData<MultiGeoPointValues> load(LeafReaderContext context) {
|
||||
GeoPointFieldScript script = leafFactory.newInstance(context);
|
||||
return new AbstractLeafGeoPointFieldData(toScriptFieldFactory) {
|
||||
return new LeafGeoPointFieldData(toScriptFieldFactory) {
|
||||
@Override
|
||||
public SortedNumericDocValues getSortedNumericDocValues() {
|
||||
return new GeoPointScriptDocValues(script);
|
||||
|
@ -111,7 +110,7 @@ public class GeoPointScriptFieldData implements IndexGeoPointFieldData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LeafPointFieldData<GeoPoint> loadDirect(LeafReaderContext context) {
|
||||
public LeafPointFieldData<MultiGeoPointValues> loadDirect(LeafReaderContext context) {
|
||||
return load(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
|
||||
/**
|
||||
* Specialization of {@link IndexFieldData} for geo points.
|
||||
*/
|
||||
public interface IndexGeoPointFieldData extends IndexPointFieldData<GeoPoint> {}
|
||||
public interface IndexGeoPointFieldData extends IndexPointFieldData<MultiGeoPointValues> {}
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.elasticsearch.common.geo.ElasticPoint;
|
||||
|
||||
/**
|
||||
* Specialization of {@link IndexFieldData} for geo points and points.
|
||||
*/
|
||||
public interface IndexPointFieldData<T extends ElasticPoint> extends IndexFieldData<LeafPointFieldData<T>> {}
|
||||
public interface IndexPointFieldData<T extends MultiPointValues<?>> extends IndexFieldData<LeafPointFieldData<T>> {}
|
||||
|
|
|
@ -8,17 +8,16 @@
|
|||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.apache.lucene.index.SortedNumericDocValues;
|
||||
import org.elasticsearch.common.geo.ElasticPoint;
|
||||
|
||||
/**
|
||||
* {@link LeafFieldData} specialization for geo points and points.
|
||||
*/
|
||||
public abstract class LeafPointFieldData<T extends ElasticPoint> implements LeafFieldData {
|
||||
public abstract class LeafPointFieldData<T extends MultiPointValues<?>> implements LeafFieldData {
|
||||
|
||||
/**
|
||||
* Return geo-point or point values.
|
||||
*/
|
||||
public abstract MultiPointValues<T> getPointValues();
|
||||
public abstract T getPointValues();
|
||||
|
||||
/**
|
||||
* Return the internal representation of geo_point or point doc values as a {@link SortedNumericDocValues}.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.elasticsearch.index.fielddata.plain;
|
||||
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.common.geo.ElasticPoint;
|
||||
import org.elasticsearch.common.util.BigArrays;
|
||||
import org.elasticsearch.core.Nullable;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
|
||||
|
@ -21,16 +20,16 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
|||
import org.elasticsearch.search.sort.BucketedSort;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
|
||||
public abstract class AbstractPointIndexFieldData<T extends ElasticPoint> implements IndexPointFieldData<T> {
|
||||
abstract class AbstractPointIndexFieldData<T extends MultiPointValues<?>> implements IndexPointFieldData<T> {
|
||||
|
||||
protected final String fieldName;
|
||||
protected final ValuesSourceType valuesSourceType;
|
||||
protected final ToScriptFieldFactory<MultiPointValues<T>> toScriptFieldFactory;
|
||||
protected final ToScriptFieldFactory<T> toScriptFieldFactory;
|
||||
|
||||
protected AbstractPointIndexFieldData(
|
||||
String fieldName,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ToScriptFieldFactory<MultiPointValues<T>> toScriptFieldFactory
|
||||
ToScriptFieldFactory<T> toScriptFieldFactory
|
||||
) {
|
||||
this.fieldName = fieldName;
|
||||
this.valuesSourceType = valuesSourceType;
|
||||
|
|
|
@ -11,19 +11,18 @@ import org.apache.lucene.index.DocValues;
|
|||
import org.apache.lucene.index.LeafReader;
|
||||
import org.apache.lucene.index.SortedNumericDocValues;
|
||||
import org.apache.lucene.util.Accountable;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.script.field.ToScriptFieldFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
final class LatLonPointDVLeafFieldData extends AbstractLeafGeoPointFieldData {
|
||||
final class LatLonPointDVLeafFieldData extends LeafGeoPointFieldData {
|
||||
private final LeafReader reader;
|
||||
private final String fieldName;
|
||||
|
||||
LatLonPointDVLeafFieldData(LeafReader reader, String fieldName, ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory) {
|
||||
LatLonPointDVLeafFieldData(LeafReader reader, String fieldName, ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory) {
|
||||
super(toScriptFieldFactory);
|
||||
this.reader = reader;
|
||||
this.fieldName = fieldName;
|
||||
|
|
|
@ -13,27 +13,26 @@ import org.apache.lucene.index.DocValuesType;
|
|||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.LeafReader;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
|
||||
import org.elasticsearch.index.fielddata.IndexGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.LeafPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
import org.elasticsearch.script.field.ToScriptFieldFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
||||
public class LatLonPointIndexFieldData extends AbstractPointIndexFieldData<GeoPoint> implements IndexGeoPointFieldData {
|
||||
public final class LatLonPointIndexFieldData extends AbstractPointIndexFieldData<MultiGeoPointValues> implements IndexGeoPointFieldData {
|
||||
public LatLonPointIndexFieldData(
|
||||
String fieldName,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory
|
||||
ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory
|
||||
) {
|
||||
super(fieldName, valuesSourceType, toScriptFieldFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeafPointFieldData<GeoPoint> load(LeafReaderContext context) {
|
||||
public LeafPointFieldData<MultiGeoPointValues> load(LeafReaderContext context) {
|
||||
LeafReader reader = context.reader();
|
||||
FieldInfo info = reader.getFieldInfos().fieldInfo(fieldName);
|
||||
if (info != null) {
|
||||
|
@ -43,7 +42,7 @@ public class LatLonPointIndexFieldData extends AbstractPointIndexFieldData<GeoPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public LeafPointFieldData<GeoPoint> loadDirect(LeafReaderContext context) throws Exception {
|
||||
public LeafPointFieldData<MultiGeoPointValues> loadDirect(LeafReaderContext context) throws Exception {
|
||||
return load(context);
|
||||
}
|
||||
|
||||
|
@ -67,13 +66,9 @@ public class LatLonPointIndexFieldData extends AbstractPointIndexFieldData<GeoPo
|
|||
public static class Builder implements IndexFieldData.Builder {
|
||||
private final String name;
|
||||
private final ValuesSourceType valuesSourceType;
|
||||
private final ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory;
|
||||
private final ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory;
|
||||
|
||||
public Builder(
|
||||
String name,
|
||||
ValuesSourceType valuesSourceType,
|
||||
ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory
|
||||
) {
|
||||
public Builder(String name, ValuesSourceType valuesSourceType, ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory) {
|
||||
this.name = name;
|
||||
this.valuesSourceType = valuesSourceType;
|
||||
this.toScriptFieldFactory = toScriptFieldFactory;
|
||||
|
|
|
@ -7,20 +7,18 @@
|
|||
*/
|
||||
package org.elasticsearch.index.fielddata.plain;
|
||||
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.index.fielddata.FieldData;
|
||||
import org.elasticsearch.index.fielddata.LeafPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
|
||||
import org.elasticsearch.script.field.DocValuesScriptFieldFactory;
|
||||
import org.elasticsearch.script.field.ToScriptFieldFactory;
|
||||
|
||||
public abstract class AbstractLeafGeoPointFieldData extends LeafPointFieldData<GeoPoint> {
|
||||
public abstract class LeafGeoPointFieldData extends LeafPointFieldData<MultiGeoPointValues> {
|
||||
|
||||
protected final ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory;
|
||||
protected final ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory;
|
||||
|
||||
public AbstractLeafGeoPointFieldData(ToScriptFieldFactory<MultiPointValues<GeoPoint>> toScriptFieldFactory) {
|
||||
public LeafGeoPointFieldData(ToScriptFieldFactory<MultiGeoPointValues> toScriptFieldFactory) {
|
||||
this.toScriptFieldFactory = toScriptFieldFactory;
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.core.TimeValue;
|
|||
import org.elasticsearch.index.fielddata.FieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.NumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.SortingNumericDoubleValues;
|
||||
|
@ -382,7 +382,7 @@ public abstract class DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>
|
|||
|
||||
@Override
|
||||
protected NumericDoubleValues distance(LeafReaderContext context) {
|
||||
final MultiPointValues<GeoPoint> geoPointValues = fieldData.load(context).getPointValues();
|
||||
final MultiGeoPointValues geoPointValues = fieldData.load(context).getPointValues();
|
||||
return FieldData.replaceMissing(mode.select(new SortingNumericDoubleValues() {
|
||||
@Override
|
||||
public boolean advanceExact(int docId) throws IOException {
|
||||
|
@ -413,7 +413,7 @@ public abstract class DecayFunctionBuilder<DFB extends DecayFunctionBuilder<DFB>
|
|||
protected String getDistanceString(LeafReaderContext ctx, int docId) throws IOException {
|
||||
StringBuilder values = new StringBuilder(mode.name());
|
||||
values.append(" of: [");
|
||||
final MultiPointValues<GeoPoint> geoPointValues = fieldData.load(ctx).getPointValues();
|
||||
final MultiGeoPointValues geoPointValues = fieldData.load(ctx).getPointValues();
|
||||
if (geoPointValues.advanceExact(docId)) {
|
||||
final int num = geoPointValues.docValueCount();
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
|
@ -11,14 +11,14 @@ package org.elasticsearch.script.field;
|
|||
import org.elasticsearch.common.geo.GeoBoundingBox;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.geo.GeoUtils;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.ScriptDocValues;
|
||||
|
||||
public class GeoPointDocValuesField extends PointDocValuesField<GeoPoint> {
|
||||
// maintain bwc by making centroid and bounding box available to ScriptDocValues.GeoPoints
|
||||
private ScriptDocValues.GeoPoints geoPoints = null;
|
||||
|
||||
public GeoPointDocValuesField(MultiPointValues<GeoPoint> input, String name) {
|
||||
public GeoPointDocValuesField(MultiGeoPointValues input, String name) {
|
||||
super(input, name, GeoPoint::new, new GeoBoundingBox(new GeoPoint(), new GeoPoint()), new GeoPoint[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class CellIdSource extends ValuesSource.Numeric {
|
|||
@Override
|
||||
public final SortedNumericDocValues longValues(LeafReaderContext ctx) {
|
||||
final MultiGeoPointValues multiGeoPointValues = valuesSource.geoPointValues(ctx);
|
||||
final GeoPointValues values = (GeoPointValues) org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(multiGeoPointValues);
|
||||
final GeoPointValues values = org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(multiGeoPointValues);
|
||||
if (geoBoundingBox.isUnbounded()) {
|
||||
return values == null ? unboundedCellMultiValues(multiGeoPointValues) : DocValues.singleton(unboundedCellSingleValue(values));
|
||||
} else {
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.elasticsearch.common.util.CollectionUtils;
|
|||
import org.elasticsearch.index.fielddata.AbstractSortingNumericDocValues;
|
||||
import org.elasticsearch.index.fielddata.DocValueBits;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.LeafOrdinalsFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
|
||||
|
@ -744,9 +744,9 @@ public abstract class ValuesSource {
|
|||
|
||||
public static class Fielddata extends GeoPoint {
|
||||
|
||||
protected final IndexPointFieldData<org.elasticsearch.common.geo.GeoPoint> indexFieldData;
|
||||
protected final IndexGeoPointFieldData indexFieldData;
|
||||
|
||||
public Fielddata(IndexPointFieldData<org.elasticsearch.common.geo.GeoPoint> indexFieldData) {
|
||||
public Fielddata(IndexGeoPointFieldData indexFieldData) {
|
||||
this.indexFieldData = indexFieldData;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.elasticsearch.index.fielddata.FieldData;
|
|||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
|
||||
import org.elasticsearch.index.fielddata.IndexGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.NumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
|
||||
import org.elasticsearch.index.fielddata.plain.LatLonPointIndexFieldData;
|
||||
|
@ -642,7 +642,7 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
}
|
||||
|
||||
private NumericDoubleValues getNumericDoubleValues(LeafReaderContext context) throws IOException {
|
||||
final MultiPointValues<GeoPoint> geoPointValues = geoIndexFieldData.load(context).getPointValues();
|
||||
final MultiGeoPointValues geoPointValues = geoIndexFieldData.load(context).getPointValues();
|
||||
final SortedNumericDoubleValues distanceValues = GeoUtils.distanceValues(geoDistance, unit, geoPointValues, localPoints);
|
||||
if (nested == null) {
|
||||
return FieldData.replaceMissing(sortMode.select(distanceValues), Double.POSITIVE_INFINITY);
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.elasticsearch.index.fielddata.plain.AbstractLeafGeoPointFieldData;
|
||||
import org.elasticsearch.index.fielddata.plain.LeafGeoPointFieldData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class GeoFieldDataTests extends AbstractGeoFieldDataTestCase {
|
|||
LeafFieldData fieldData = indexFieldData.load(readerContext);
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(minRamBytesUsed()));
|
||||
|
||||
MultiGeoPointValues fieldValues = ((AbstractLeafGeoPointFieldData) fieldData).getPointValues();
|
||||
MultiGeoPointValues fieldValues = ((LeafGeoPointFieldData) fieldData).getPointValues();
|
||||
assertValues(fieldValues, 0);
|
||||
assertValues(fieldValues, 1);
|
||||
assertValues(fieldValues, 2);
|
||||
|
@ -165,7 +165,7 @@ public class GeoFieldDataTests extends AbstractGeoFieldDataTestCase {
|
|||
LeafFieldData fieldData = indexFieldData.load(readerContext);
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(minRamBytesUsed()));
|
||||
|
||||
MultiGeoPointValues fieldValues = ((AbstractLeafGeoPointFieldData) fieldData).getPointValues();
|
||||
MultiGeoPointValues fieldValues = ((LeafGeoPointFieldData) fieldData).getPointValues();
|
||||
assertValues(fieldValues, 0);
|
||||
assertMissing(fieldValues, 1);
|
||||
assertValues(fieldValues, 2);
|
||||
|
@ -181,7 +181,7 @@ public class GeoFieldDataTests extends AbstractGeoFieldDataTestCase {
|
|||
LeafFieldData fieldData = indexFieldData.load(readerContext);
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(minRamBytesUsed()));
|
||||
|
||||
MultiGeoPointValues fieldValues = ((AbstractLeafGeoPointFieldData) fieldData).getPointValues();
|
||||
MultiGeoPointValues fieldValues = ((LeafGeoPointFieldData) fieldData).getPointValues();
|
||||
assertValues(fieldValues, 0);
|
||||
assertValues(fieldValues, 1);
|
||||
assertValues(fieldValues, 2);
|
||||
|
@ -197,7 +197,7 @@ public class GeoFieldDataTests extends AbstractGeoFieldDataTestCase {
|
|||
LeafFieldData fieldData = indexFieldData.load(readerContext);
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(minRamBytesUsed()));
|
||||
|
||||
MultiGeoPointValues fieldValues = ((AbstractLeafGeoPointFieldData) fieldData).getPointValues();
|
||||
MultiGeoPointValues fieldValues = ((LeafGeoPointFieldData) fieldData).getPointValues();
|
||||
|
||||
assertValues(fieldValues, 0);
|
||||
assertMissing(fieldValues, 1);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.geo.GeoPoint;
|
|||
import org.elasticsearch.common.lucene.search.function.ScriptScoreQuery;
|
||||
import org.elasticsearch.geo.GeometryTestUtils;
|
||||
import org.elasticsearch.index.fielddata.GeoPointScriptFieldData;
|
||||
import org.elasticsearch.index.fielddata.MultiPointValues;
|
||||
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
|
||||
import org.elasticsearch.index.fielddata.ScriptDocValues;
|
||||
import org.elasticsearch.index.query.SearchExecutionContext;
|
||||
import org.elasticsearch.script.DocReader;
|
||||
|
@ -74,7 +74,7 @@ public class GeoPointScriptFieldTypeTests extends AbstractNonTextScriptFieldType
|
|||
|
||||
@Override
|
||||
public LeafCollector getLeafCollector(LeafReaderContext context) {
|
||||
MultiPointValues<GeoPoint> dv = ifd.load(context).getPointValues();
|
||||
MultiGeoPointValues dv = ifd.load(context).getPointValues();
|
||||
return new LeafCollector() {
|
||||
@Override
|
||||
public void setScorer(Scorable scorer) {}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class GeoHexAggregatorTests extends GeoGridAggregatorTestCase<InternalGeo
|
|||
|
||||
@Override
|
||||
protected List<ValuesSourceType> getSupportedValuesSourceTypes() {
|
||||
// TODO: why is shape here already, it is not supported yet
|
||||
return List.of(GeoShapeValuesSourceType.instance(), CoreValuesSourceType.GEOPOINT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue