4545import org .elasticsearch .index .fielddata .plain .SortedNumericIndexFieldData ;
4646import org .elasticsearch .index .mapper .TimeSeriesParams .MetricType ;
4747import org .elasticsearch .index .query .SearchExecutionContext ;
48- import org .elasticsearch .lucene .document .NumericField ;
4948import org .elasticsearch .lucene .search .XIndexSortSortedNumericDocValuesRangeQuery ;
5049import org .elasticsearch .script .DoubleFieldScript ;
5150import org .elasticsearch .script .LongFieldScript ;
@@ -353,19 +352,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
353352 }
354353
355354 @ Override
356- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
355+ public Query termQuery (String field , Object value , boolean isIndexed ) {
357356 float v = parseToFloat (value );
358357 if (Float .isFinite (HalfFloatPoint .sortableShortToHalfFloat (HalfFloatPoint .halfFloatToSortableShort (v ))) == false ) {
359358 return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
360359 }
361360
362361 if (isIndexed ) {
363- if (hasDocValues ) {
364- return new IndexOrDocValuesQuery (
365- HalfFloatPoint .newExactQuery (field , v ),
366- SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ))
367- );
368- }
369362 return HalfFloatPoint .newExactQuery (field , v );
370363 } else {
371364 return SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ));
@@ -549,15 +542,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
549542 }
550543
551544 @ Override
552- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
545+ public Query termQuery (String field , Object value , boolean isIndexed ) {
553546 float v = parseToFloat (value );
554547 if (Float .isFinite (v ) == false ) {
555548 return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
556549 }
557550
558- if (isIndexed && hasDocValues ) {
559- return FloatField .newExactQuery (field , v );
560- } else if (isIndexed ) {
551+ if (isIndexed ) {
561552 return FloatPoint .newExactQuery (field , v );
562553 } else {
563554 return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .floatToSortableInt (v ));
@@ -724,15 +715,13 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
724715 }
725716
726717 @ Override
727- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
718+ public Query termQuery (String field , Object value , boolean isIndexed ) {
728719 double v = objectToDouble (value );
729720 if (Double .isFinite (v ) == false ) {
730721 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
731722 }
732723
733- if (isIndexed && hasDocValues ) {
734- return DoubleField .newExactQuery (field , v );
735- } else if (isIndexed ) {
724+ if (isIndexed ) {
736725 return DoublePoint .newExactQuery (field , v );
737726 } else {
738727 return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .doubleToSortableLong (v ));
@@ -886,12 +875,12 @@ public Byte parse(XContentParser parser, boolean coerce) throws IOException {
886875 }
887876
888877 @ Override
889- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
878+ public Query termQuery (String field , Object value , boolean isIndexed ) {
890879 if (isOutOfRange (value )) {
891880 return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
892881 }
893882
894- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
883+ return INTEGER .termQuery (field , value , isIndexed );
895884 }
896885
897886 @ Override
@@ -1010,11 +999,11 @@ public Short parse(XContentParser parser, boolean coerce) throws IOException {
1010999 }
10111000
10121001 @ Override
1013- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1002+ public Query termQuery (String field , Object value , boolean isIndexed ) {
10141003 if (isOutOfRange (value )) {
10151004 return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
10161005 }
1017- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
1006+ return INTEGER .termQuery (field , value , isIndexed );
10181007 }
10191008
10201009 @ Override
@@ -1136,7 +1125,7 @@ public Integer parse(XContentParser parser, boolean coerce) throws IOException {
11361125 }
11371126
11381127 @ Override
1139- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1128+ public Query termQuery (String field , Object value , boolean isIndexed ) {
11401129 if (hasDecimalPart (value )) {
11411130 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
11421131 }
@@ -1147,9 +1136,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
11471136 }
11481137 int v = parse (value , true );
11491138
1150- if (isIndexed && hasDocValues ) {
1151- return NumericField .newExactIntQuery (field , v );
1152- } else if (isIndexed ) {
1139+ if (isIndexed ) {
11531140 return IntPoint .newExactQuery (field , v );
11541141 } else {
11551142 return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1322,7 +1309,7 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
13221309 }
13231310
13241311 @ Override
1325- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1312+ public Query termQuery (String field , Object value , boolean isIndexed ) {
13261313 if (hasDecimalPart (value )) {
13271314 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
13281315 }
@@ -1331,9 +1318,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
13311318 }
13321319
13331320 long v = parse (value , true );
1334- if (isIndexed && hasDocValues ) {
1335- return NumericField .newExactLongQuery (field , v );
1336- } else if (isIndexed ) {
1321+ if (isIndexed ) {
13371322 return LongPoint .newExactQuery (field , v );
13381323 } else {
13391324 return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1517,7 +1502,7 @@ public final TypeParser parser() {
15171502 return parser ;
15181503 }
15191504
1520- public abstract Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues );
1505+ public abstract Query termQuery (String field , Object value , boolean isIndexed );
15211506
15221507 public abstract Query termsQuery (String field , Collection <?> values );
15231508
@@ -1908,11 +1893,11 @@ public NumberFieldType(
19081893 }
19091894
19101895 public NumberFieldType (String name , NumberType type ) {
1911- this (name , type , true , true );
1896+ this (name , type , true );
19121897 }
19131898
1914- public NumberFieldType (String name , NumberType type , boolean isIndexed , boolean hasDocValues ) {
1915- this (name , type , isIndexed , false , hasDocValues , true , null , Collections .emptyMap (), null , false , null , null , false );
1899+ public NumberFieldType (String name , NumberType type , boolean isIndexed ) {
1900+ this (name , type , isIndexed , false , true , true , null , Collections .emptyMap (), null , false , null , null , false );
19161901 }
19171902
19181903 @ Override
@@ -1951,7 +1936,7 @@ public boolean isSearchable() {
19511936 @ Override
19521937 public Query termQuery (Object value , SearchExecutionContext context ) {
19531938 failIfNotIndexedNorDocValuesFallback (context );
1954- return type .termQuery (name (), value , isIndexed (), hasDocValues () );
1939+ return type .termQuery (name (), value , isIndexed ());
19551940 }
19561941
19571942 @ Override
0 commit comments