timestamp term match broken in 0.18.5, closes #1543.

This commit is contained in:
Shay Banon 2011-12-15 20:49:38 +02:00
parent 922833cdc4
commit f745b80edb
1 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import org.apache.lucene.search.NumericRangeFilter;
import org.apache.lucene.search.NumericRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
@ -38,6 +39,7 @@ import org.elasticsearch.index.analysis.NumericDateAnalyzer;
import org.elasticsearch.index.cache.field.data.FieldDataCache;
import org.elasticsearch.index.field.data.FieldDataType;
import org.elasticsearch.index.mapper.*;
import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.index.search.NumericRangeFieldDataFilter;
import org.joda.time.DateTimeZone;
import org.joda.time.MutableDateTime;
@ -227,6 +229,13 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
true, true);
}
@Override
public Query fieldQuery(String value, @Nullable QueryParseContext context) {
long lValue = parseStringValue(value);
return NumericRangeQuery.newLongRange(names.indexName(), precisionStep,
lValue, lValue, true, true);
}
@Override
public Query rangeQuery(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) {
return NumericRangeQuery.newLongRange(names.indexName(), precisionStep,
@ -235,6 +244,13 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
includeLower, includeUpper);
}
@Override
public Filter fieldFilter(String value, @Nullable QueryParseContext context) {
long lValue = parseStringValue(value);
return NumericRangeFilter.newLongRange(names.indexName(), precisionStep,
lValue, lValue, true, true);
}
@Override
public Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper) {
return NumericRangeFilter.newLongRange(names.indexName(), precisionStep,