示例#1
0
 /*
  * `timeZone` parameter is only applied when:
  * - not null
  * - the object to parse is a String (does not apply to ms since epoch which are UTC based time values)
  * - the String to parse does not have already a timezone defined (ie. `2014-01-01T00:00:00+03:00`)
  */
 public Filter rangeFilter(
     QueryParseContext parseContext,
     Object lowerTerm,
     Object upperTerm,
     boolean includeLower,
     boolean includeUpper,
     @Nullable DateTimeZone timeZone,
     @Nullable DateMathParser forcedDateParser,
     @Nullable QueryParseContext context,
     @Nullable Boolean explicitCaching) {
   IndexNumericFieldData fieldData =
       parseContext != null ? (IndexNumericFieldData) parseContext.getForField(this) : null;
   // If the current search context is null we're parsing percolator query or a index alias filter.
   if (SearchContext.current() == null) {
     return new LateParsingFilter(
         fieldData,
         lowerTerm,
         upperTerm,
         includeLower,
         includeUpper,
         timeZone,
         forcedDateParser,
         explicitCaching);
   } else {
     return innerRangeFilter(
         fieldData,
         lowerTerm,
         upperTerm,
         includeLower,
         includeUpper,
         timeZone,
         forcedDateParser,
         explicitCaching);
   }
 }
示例#2
0
 @Override
 public Filter rangeFilter(
     QueryParseContext parseContext,
     Object lowerTerm,
     Object upperTerm,
     boolean includeLower,
     boolean includeUpper,
     @Nullable QueryParseContext context) {
   return NumericRangeFieldDataFilter.newLongRange(
       (IndexNumericFieldData) parseContext.getForField(this),
       lowerTerm == null ? null : parseValue(lowerTerm),
       upperTerm == null ? null : parseValue(upperTerm),
       includeLower,
       includeUpper);
 }