|
26 | 26 | import org.apache.lucene.search.NumericRangeQuery;
|
27 | 27 | import org.apache.lucene.search.Query;
|
28 | 28 | import org.apache.lucene.util.NumericUtils;
|
| 29 | +import org.elasticsearch.common.Nullable; |
29 | 30 | import org.elasticsearch.common.Numbers;
|
30 | 31 | import org.elasticsearch.common.Strings;
|
31 | 32 | import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
|
44 | 45 | import org.elasticsearch.index.mapper.MergeContext;
|
45 | 46 | import org.elasticsearch.index.mapper.MergeMappingException;
|
46 | 47 | import org.elasticsearch.index.mapper.ParseContext;
|
| 48 | +import org.elasticsearch.index.query.QueryParseContext; |
47 | 49 | import org.elasticsearch.index.search.NumericRangeFieldDataFilter;
|
48 | 50 |
|
49 | 51 | import java.io.IOException;
|
@@ -219,13 +221,25 @@ protected DateFieldMapper(Names names, FormatDateTimeFormatter dateTimeFormatter
|
219 | 221 | true, true);
|
220 | 222 | }
|
221 | 223 |
|
| 224 | + @Override public Query fieldQuery(String value, @Nullable QueryParseContext context) { |
| 225 | + long lValue = parseStringValue(value); |
| 226 | + return NumericRangeQuery.newLongRange(names.indexName(), precisionStep, |
| 227 | + lValue, lValue, true, true); |
| 228 | + } |
| 229 | + |
222 | 230 | @Override public Query rangeQuery(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) {
|
223 | 231 | return NumericRangeQuery.newLongRange(names.indexName(), precisionStep,
|
224 | 232 | lowerTerm == null ? null : parseStringValue(lowerTerm),
|
225 | 233 | upperTerm == null ? null : includeUpper ? parseUpperInclusiveStringValue(upperTerm) : parseStringValue(upperTerm),
|
226 | 234 | includeLower, includeUpper);
|
227 | 235 | }
|
228 | 236 |
|
| 237 | + @Override public Filter fieldFilter(String value, @Nullable QueryParseContext context) { |
| 238 | + long lValue = parseStringValue(value); |
| 239 | + return NumericRangeFilter.newLongRange(names.indexName(), precisionStep, |
| 240 | + lValue, lValue, true, true); |
| 241 | + } |
| 242 | + |
229 | 243 | @Override public Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) {
|
230 | 244 | return NumericRangeFilter.newLongRange(names.indexName(), precisionStep,
|
231 | 245 | lowerTerm == null ? null : parseStringValue(lowerTerm),
|
|
0 commit comments