46
46
import org .elasticsearch .index .fielddata .plain .SortedNumericIndexFieldData ;
47
47
import org .elasticsearch .index .mapper .TimeSeriesParams .MetricType ;
48
48
import org .elasticsearch .index .query .SearchExecutionContext ;
49
- import org .elasticsearch .lucene .document .NumericField ;
50
49
import org .elasticsearch .lucene .search .XIndexSortSortedNumericDocValuesRangeQuery ;
51
50
import org .elasticsearch .script .DoubleFieldScript ;
52
51
import org .elasticsearch .script .LongFieldScript ;
@@ -352,19 +351,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
352
351
}
353
352
354
353
@ Override
355
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
354
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
356
355
float v = parseToFloat (value );
357
356
if (Float .isFinite (HalfFloatPoint .sortableShortToHalfFloat (HalfFloatPoint .halfFloatToSortableShort (v ))) == false ) {
358
357
return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
359
358
}
360
359
361
360
if (isIndexed ) {
362
- if (hasDocValues ) {
363
- return new IndexOrDocValuesQuery (
364
- HalfFloatPoint .newExactQuery (field , v ),
365
- SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ))
366
- );
367
- }
368
361
return HalfFloatPoint .newExactQuery (field , v );
369
362
} else {
370
363
return SortedNumericDocValuesField .newSlowExactQuery (field , HalfFloatPoint .halfFloatToSortableShort (v ));
@@ -548,15 +541,13 @@ public Float parse(XContentParser parser, boolean coerce) throws IOException {
548
541
}
549
542
550
543
@ Override
551
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
544
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
552
545
float v = parseToFloat (value );
553
546
if (Float .isFinite (v ) == false ) {
554
547
return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
555
548
}
556
549
557
- if (isIndexed && hasDocValues ) {
558
- return FloatField .newExactQuery (field , v );
559
- } else if (isIndexed ) {
550
+ if (isIndexed ) {
560
551
return FloatPoint .newExactQuery (field , v );
561
552
} else {
562
553
return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .floatToSortableInt (v ));
@@ -723,15 +714,13 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
723
714
}
724
715
725
716
@ Override
726
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
717
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
727
718
double v = objectToDouble (value );
728
719
if (Double .isFinite (v ) == false ) {
729
720
return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
730
721
}
731
722
732
- if (isIndexed && hasDocValues ) {
733
- return DoubleField .newExactQuery (field , v );
734
- } else if (isIndexed ) {
723
+ if (isIndexed ) {
735
724
return DoublePoint .newExactQuery (field , v );
736
725
} else {
737
726
return SortedNumericDocValuesField .newSlowExactQuery (field , NumericUtils .doubleToSortableLong (v ));
@@ -885,12 +874,12 @@ public Byte parse(XContentParser parser, boolean coerce) throws IOException {
885
874
}
886
875
887
876
@ Override
888
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
877
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
889
878
if (isOutOfRange (value )) {
890
879
return new MatchNoDocsQuery ("Value [" + value + "] is out of range" );
891
880
}
892
881
893
- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
882
+ return INTEGER .termQuery (field , value , isIndexed );
894
883
}
895
884
896
885
@ Override
@@ -1009,11 +998,11 @@ public Short parse(XContentParser parser, boolean coerce) throws IOException {
1009
998
}
1010
999
1011
1000
@ Override
1012
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1001
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
1013
1002
if (isOutOfRange (value )) {
1014
1003
return Queries .newMatchNoDocsQuery ("Value [" + value + "] is out of range" );
1015
1004
}
1016
- return INTEGER .termQuery (field , value , isIndexed , hasDocValues );
1005
+ return INTEGER .termQuery (field , value , isIndexed );
1017
1006
}
1018
1007
1019
1008
@ Override
@@ -1135,7 +1124,7 @@ public Integer parse(XContentParser parser, boolean coerce) throws IOException {
1135
1124
}
1136
1125
1137
1126
@ Override
1138
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1127
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
1139
1128
if (hasDecimalPart (value )) {
1140
1129
return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
1141
1130
}
@@ -1146,9 +1135,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
1146
1135
}
1147
1136
int v = parse (value , true );
1148
1137
1149
- if (isIndexed && hasDocValues ) {
1150
- return NumericField .newExactIntQuery (field , v );
1151
- } else if (isIndexed ) {
1138
+ if (isIndexed ) {
1152
1139
return IntPoint .newExactQuery (field , v );
1153
1140
} else {
1154
1141
return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1321,7 +1308,7 @@ public FieldValues<Number> compile(String fieldName, Script script, ScriptCompil
1321
1308
}
1322
1309
1323
1310
@ Override
1324
- public Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues ) {
1311
+ public Query termQuery (String field , Object value , boolean isIndexed ) {
1325
1312
if (hasDecimalPart (value )) {
1326
1313
return Queries .newMatchNoDocsQuery ("Value [" + value + "] has a decimal part" );
1327
1314
}
@@ -1330,9 +1317,7 @@ public Query termQuery(String field, Object value, boolean isIndexed, boolean ha
1330
1317
}
1331
1318
1332
1319
long v = parse (value , true );
1333
- if (isIndexed && hasDocValues ) {
1334
- return NumericField .newExactLongQuery (field , v );
1335
- } else if (isIndexed ) {
1320
+ if (isIndexed ) {
1336
1321
return LongPoint .newExactQuery (field , v );
1337
1322
} else {
1338
1323
return SortedNumericDocValuesField .newSlowExactQuery (field , v );
@@ -1515,7 +1500,7 @@ public final TypeParser parser() {
1515
1500
return parser ;
1516
1501
}
1517
1502
1518
- public abstract Query termQuery (String field , Object value , boolean isIndexed , boolean hasDocValues );
1503
+ public abstract Query termQuery (String field , Object value , boolean isIndexed );
1519
1504
1520
1505
public abstract Query termsQuery (String field , Collection <?> values );
1521
1506
@@ -1906,11 +1891,11 @@ public NumberFieldType(
1906
1891
}
1907
1892
1908
1893
public NumberFieldType (String name , NumberType type ) {
1909
- this (name , type , true , true );
1894
+ this (name , type , true );
1910
1895
}
1911
1896
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 );
1914
1899
}
1915
1900
1916
1901
@ Override
@@ -1949,7 +1934,7 @@ public boolean isSearchable() {
1949
1934
@ Override
1950
1935
public Query termQuery (Object value , SearchExecutionContext context ) {
1951
1936
failIfNotIndexedNorDocValuesFallback (context );
1952
- return type .termQuery (name (), value , isIndexed (), hasDocValues () );
1937
+ return type .termQuery (name (), value , isIndexed ());
1953
1938
}
1954
1939
1955
1940
@ Override
0 commit comments