Java Code Examples for org.apache.lucene.search.NumericRangeQuery#includesMin()

The following examples show how to use org.apache.lucene.search.NumericRangeQuery#includesMin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightHelper.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static boolean checkLong(String name, Number numericValue, Query query) {
  long value = (Long) numericValue;
  NumericRangeQuery<Long> nrq = (NumericRangeQuery<Long>) query;
  if (!name.equals(nrq.getField())) {
    return false;
  }
  if (nrq.includesMin()) {
    if (nrq.includesMax()) {
      if (value >= nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value >= nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  } else {
    if (nrq.includesMax()) {
      if (value > nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value > nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  }
  return false;
}
 
Example 2
Source File: HighlightHelper.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static boolean checkFloat(String name, Number numericValue, Query query) {
  float value = (Float) numericValue;
  NumericRangeQuery<Float> nrq = (NumericRangeQuery<Float>) query;
  if (!name.equals(nrq.getField())) {
    return false;
  }
  if (nrq.includesMin()) {
    if (nrq.includesMax()) {
      if (value >= nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value >= nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  } else {
    if (nrq.includesMax()) {
      if (value > nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value > nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  }
  return false;
}
 
Example 3
Source File: HighlightHelper.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static boolean checkDouble(String name, Number numericValue, Query query) {
  double value = (Double) numericValue;
  NumericRangeQuery<Double> nrq = (NumericRangeQuery<Double>) query;
  if (!name.equals(nrq.getField())) {
    return false;
  }
  if (nrq.includesMin()) {
    if (nrq.includesMax()) {
      if (value >= nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value >= nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  } else {
    if (nrq.includesMax()) {
      if (value > nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value > nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  }
  return false;
}
 
Example 4
Source File: HighlightHelper.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static boolean checkInteger(String name, Number numericValue, Query query) {
  int value = (Integer) numericValue;
  NumericRangeQuery<Integer> nrq = (NumericRangeQuery<Integer>) query;
  if (!name.equals(nrq.getField())) {
    return false;
  }
  if (nrq.includesMin()) {
    if (nrq.includesMax()) {
      if (value >= nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value >= nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  } else {
    if (nrq.includesMax()) {
      if (value > nrq.getMin() && value <= nrq.getMax()) {
        return true;
      }
    } else {
      if (value > nrq.getMin() && value < nrq.getMax()) {
        return true;
      }
    }
  }
  return false;
}