4646import org .elasticsearch .index .fielddata .plain .SortedNumericIndexFieldData ;
4747import org .elasticsearch .index .mapper .TimeSeriesParams .MetricType ;
4848import org .elasticsearch .index .query .SearchExecutionContext ;
49- import org .elasticsearch .lucene .document .NumericField ;
5049import org .elasticsearch .lucene .search .XIndexSortSortedNumericDocValuesRangeQuery ;
5150import org .elasticsearch .script .DoubleFieldScript ;
5251import org .elasticsearch .script .LongFieldScript ;
@@ -352,19 +351,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
352351 }
353352
354353 @ Override
355- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
354+ public Query termQuery (String field , Object value , boolean isIndexed ) {
356355 float v = parseToFloat (value );
357356 if (Float .isFinite (HalfFloatPoint .sortableShortToHalfFloat (HalfFloatPoint .halfFloatToSortableShort (v ))) == false ) {
358357 return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
359358 }
360359
361360 if (isIndexed ) {
362- if (hasDocValues ) {
363- return new IndexOrDocValuesQuery (
364- HalfFloatPoint .newExactQuery (field , v ),
365- SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ))
366- );
367- }
368361 return HalfFloatPoint .newExactQuery (field , v );
369362 } else {
370363 return SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ));
@@ -548,15 +541,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
548541 }
549542
550543 @ Override
551- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
544+ public Query termQuery (String field , Object value , boolean isIndexed ) {
552545 float v = parseToFloat (value );
553546 if (Float .isFinite (v ) == false ) {
554547 return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
555548 }
556549
557- if (isIndexed && hasDocValues ) {
558- return FloatField .newExactQuery (field , v );
559- } else if (isIndexed ) {
550+ if (isIndexed ) {
560551 return FloatPoint .newExactQuery (field , v );
561552 } else {
562553 return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .floatToSortableInt (v ));
@@ -723,15 +714,13 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
723714 }
724715
725716 @ Override
726- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
717+ public Query termQuery (String field , Object value , boolean isIndexed ) {
727718 double v = objectToDouble (value );
728719 if (Double .isFinite (v ) == false ) {
729720 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
730721 }
731722
732- if (isIndexed && hasDocValues ) {
733- return DoubleField .newExactQuery (field , v );
734- } else if (isIndexed ) {
723+ if (isIndexed ) {
735724 return DoublePoint .newExactQuery (field , v );
736725 } else {
737726 return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .doubleToSortableLong (v ));
@@ -885,12 +874,12 @@ public Byte parse(XContentParser parser, boolean coerce) throws IOException {
885874 }
886875
887876 @ Override
888- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
877+ public Query termQuery (String field , Object value , boolean isIndexed ) {
889878 if (isOutOfRange (value )) {
890879 return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
891880 }
892881
893- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
882+ return INTEGER .termQuery (field , value , isIndexed );
894883 }
895884
896885 @ Override
@@ -1009,11 +998,11 @@ public Short parse(XContentParser parser, boolean coerce) throws IOException {
1009998 }
1010999
10111000 @ Override
1012- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1001+ public Query termQuery (String field , Object value , boolean isIndexed ) {
10131002 if (isOutOfRange (value )) {
10141003 return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
10151004 }
1016- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
1005+ return INTEGER .termQuery (field , value , isIndexed );
10171006 }
10181007
10191008 @ Override
@@ -1135,7 +1124,7 @@ public Integer parse(XContentParser parser, boolean coerce) throws IOException {
11351124 }
11361125
11371126 @ Override
1138- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1127+ public Query termQuery (String field , Object value , boolean isIndexed ) {
11391128 if (hasDecimalPart (value )) {
11401129 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
11411130 }
@@ -1146,9 +1135,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
11461135 }
11471136 int v = parse (value , true );
11481137
1149- if (isIndexed && hasDocValues ) {
1150- return NumericField .newExactIntQuery (field , v );
1151- } else if (isIndexed ) {
1138+ if (isIndexed ) {
11521139 return IntPoint .newExactQuery (field , v );
11531140 } else {
11541141 return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1321,7 +1308,7 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
13211308 }
13221309
13231310 @ Override
1324- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1311+ public Query termQuery (String field , Object value , boolean isIndexed ) {
13251312 if (hasDecimalPart (value )) {
13261313 return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
13271314 }
@@ -1330,9 +1317,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
13301317 }
13311318
13321319 long v = parse (value , true );
1333- if (isIndexed && hasDocValues ) {
1334- return NumericField .newExactLongQuery (field , v );
1335- } else if (isIndexed ) {
1320+ if (isIndexed ) {
13361321 return LongPoint .newExactQuery (field , v );
13371322 } else {
13381323 return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1515,7 +1500,7 @@ public final TypeParser parser() {
15151500 return parser ;
15161501 }
15171502
1518- public abstract Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues );
1503+ public abstract Query termQuery (String field , Object value , boolean isIndexed );
15191504
15201505 public abstract Query termsQuery (String field , Collection <?> values );
15211506
@@ -1906,11 +1891,11 @@ public NumberFieldType(
19061891 }
19071892
19081893 public NumberFieldType (String name , NumberType type ) {
1909- this (name , type , true , true );
1894+ this (name , type , true );
19101895 }
19111896
1912- public NumberFieldType (String name , NumberType type , boolean isIndexed , boolean hasDocValues ) {
1913- this (name , type , isIndexed , false , hasDocValues , true , null , Collections .emptyMap (), null , false , null , null , false );
1897+ public NumberFieldType (String name , NumberType type , boolean isIndexed ) {
1898+ this (name , type , isIndexed , false , true , true , null , Collections .emptyMap (), null , false , null , null , false );
19141899 }
19151900
19161901 @ Override
@@ -1949,7 +1934,7 @@ public boolean isSearchable() {
19491934 @ Override
19501935 public Query termQuery (Object value , SearchExecutionContext context ) {
19511936 failIfNotIndexedNorDocValuesFallback (context );
1952- return type .termQuery (name (), value , isIndexed (), hasDocValues () );
1937+ return type .termQuery (name (), value , isIndexed ());
19531938 }
19541939
19551940 @ Override
0 commit comments