1717import org .elasticsearch .index .mapper .ParseContext ;
1818import org .elasticsearch .xpack .spatial .common .CartesianPoint ;
1919import org .elasticsearch .xpack .spatial .index .query .ShapeQueryPointProcessor ;
20+ import org .elasticsearch .xpack .spatial .index .mapper .PointFieldMapper .ParsedCartesianPoint ;
2021
2122import java .io .IOException ;
2223import java .util .ArrayList ;
2930 *
3031 * Uses lucene 8 XYPoint encoding
3132 */
32- public class PointFieldMapper extends AbstractPointGeometryFieldMapper <List <? extends CartesianPoint >, List <? extends CartesianPoint >> {
33+ public class PointFieldMapper extends AbstractPointGeometryFieldMapper <List <ParsedCartesianPoint >, List <? extends CartesianPoint >> {
3334 public static final String CONTENT_TYPE = "point" ;
3435
3536 public static class Builder extends AbstractPointGeometryFieldMapper .Builder <Builder , PointFieldType > {
@@ -95,15 +96,13 @@ public PointFieldMapper(String simpleName, FieldType fieldType, MappedFieldType
9596 }
9697
9798 @ Override
98- @ SuppressWarnings ("unchecked" )
9999 protected void addStoredFields (ParseContext context , List <? extends CartesianPoint > points ) {
100100 for (CartesianPoint point : points ) {
101101 context .doc ().add (new StoredField (fieldType ().name (), point .toString ()));
102102 }
103103 }
104104
105105 @ Override
106- @ SuppressWarnings ("unchecked" )
107106 protected void addDocValuesFields (String name , List <? extends CartesianPoint > points , List <IndexableField > fields ,
108107 ParseContext context ) {
109108 for (CartesianPoint point : points ) {
@@ -123,10 +122,10 @@ protected String contentType() {
123122
124123 @ Override
125124 public PointFieldType fieldType () {
126- return (PointFieldType )mappedFieldType ;
125+ return (PointFieldType ) mappedFieldType ;
127126 }
128127
129- public static class PointFieldType extends AbstractPointGeometryFieldType <List <ParsedCartesianPoint >, List <ParsedCartesianPoint >> {
128+ public static class PointFieldType extends AbstractPointGeometryFieldType <List <ParsedCartesianPoint >, List <? extends CartesianPoint >> {
130129 public PointFieldType (String name , boolean indexed , boolean hasDocValues , Map <String , String > meta ) {
131130 super (name , indexed , hasDocValues , meta );
132131 }
@@ -190,15 +189,15 @@ public int hashCode() {
190189 }
191190 }
192191
193- protected static class PointIndexer implements Indexer <List <ParsedCartesianPoint >, List <ParsedCartesianPoint >> {
192+ protected static class PointIndexer implements Indexer <List <ParsedCartesianPoint >, List <? extends CartesianPoint >> {
194193 protected final PointFieldType fieldType ;
195194
196195 PointIndexer (PointFieldType fieldType ) {
197196 this .fieldType = fieldType ;
198197 }
199198
200199 @ Override
201- public List <ParsedCartesianPoint > prepareForIndexing (List <ParsedCartesianPoint > points ) {
200+ public List <? extends CartesianPoint > prepareForIndexing (List <ParsedCartesianPoint > points ) {
202201 if (points == null || points .isEmpty ()) {
203202 return Collections .emptyList ();
204203 }
@@ -207,14 +206,14 @@ public List<ParsedCartesianPoint> prepareForIndexing(List<ParsedCartesianPoint>
207206
208207 @ Override
209208 @ SuppressWarnings ("unchecked" )
210- public Class <List <ParsedCartesianPoint >> processedClass () {
211- return (Class <List <ParsedCartesianPoint >>)(Object )List .class ;
209+ public Class <List <? extends CartesianPoint >> processedClass () {
210+ return (Class <List <? extends CartesianPoint >>)(Object )List .class ;
212211 }
213212
214213 @ Override
215- public List <IndexableField > indexShape (ParseContext context , List <ParsedCartesianPoint > points ) {
214+ public List <IndexableField > indexShape (ParseContext context , List <? extends CartesianPoint > points ) {
216215 ArrayList <IndexableField > fields = new ArrayList <>(1 );
217- for (ParsedCartesianPoint point : points ) {
216+ for (CartesianPoint point : points ) {
218217 fields .add (new XYPointField (fieldType .name (), point .getX (), point .getY ()));
219218 }
220219 return fields ;
0 commit comments