Ejemplo n.º 1
0
 @Override
 public Query fuzzyQuery(
     String value,
     Fuzziness fuzziness,
     int prefixLength,
     int maxExpansions,
     boolean transpositions) {
   long iValue = ipToLong(value);
   long iSim;
   try {
     iSim = ipToLong(fuzziness.asString());
   } catch (ElasticsearchIllegalArgumentException e) {
     iSim = fuzziness.asLong();
   }
   return NumericRangeQuery.newLongRange(
       names.indexName(), precisionStep, iValue - iSim, iValue + iSim, true, true);
 }
Ejemplo n.º 2
0
 @Override
 public Query fuzzyQuery(
     String value,
     Fuzziness fuzziness,
     int prefixLength,
     int maxExpansions,
     boolean transpositions) {
   long iValue = dateMathParser.parse(value, System.currentTimeMillis());
   long iSim;
   try {
     iSim = fuzziness.asTimeValue().millis();
   } catch (Exception e) {
     // not a time format
     iSim = fuzziness.asLong();
   }
   return NumericRangeQuery.newLongRange(
       names.indexName(), precisionStep, iValue - iSim, iValue + iSim, true, true);
 }