Search in sources :

Example 1 with IntegerRangePredicate

use of com.google.gerrit.index.query.IntegerRangePredicate in project gerrit by GerritCodeReview.

the class QueryBuilder method intRangeQuery.

private Query intRangeQuery(IndexPredicate<V> p) throws QueryParseException {
    if (p instanceof IntegerRangePredicate) {
        IntegerRangePredicate<V> r = (IntegerRangePredicate<V>) p;
        String name = r.getField().getName();
        int minimum = r.getMinimumValue();
        int maximum = r.getMaximumValue();
        if (minimum == maximum) {
            // Just fall back to a standard integer query.
            return intTermQuery.get(name, minimum);
        }
        return intRangeTermQuery.get(name, minimum, maximum);
    }
    throw new QueryParseException("not an integer range: " + p);
}
Also used : IntegerRangePredicate(com.google.gerrit.index.query.IntegerRangePredicate) LongPoint(org.apache.lucene.document.LongPoint) IntPoint(org.apache.lucene.document.IntPoint) QueryParseException(com.google.gerrit.index.query.QueryParseException)

Aggregations

IntegerRangePredicate (com.google.gerrit.index.query.IntegerRangePredicate)1 QueryParseException (com.google.gerrit.index.query.QueryParseException)1 IntPoint (org.apache.lucene.document.IntPoint)1 LongPoint (org.apache.lucene.document.LongPoint)1