String fieldname = String.valueOf(condition.getField().getId());
switch (specifier) {
case IS:
case IS_NOT:
return new TermQuery(new Term(fieldname, value));
case IS_GREATER_THAN: {
Term lowerBound = new Term(fieldname, value);
Term upperBound = new Term(fieldname, MAX_NUMBER);
return new ConstantScoreRangeQuery(fieldname, lowerBound.text(), upperBound.text(), false, false);
}
case IS_LESS_THAN: {
Term lowerBound = new Term(fieldname, MIN_NUMBER);
Term upperBound = new Term(fieldname, value);
return new ConstantScoreRangeQuery(fieldname, lowerBound.text(), upperBound.text(), false, false);
}
}
throw new UnsupportedOperationException("Unsupported Specifier for Number Queries"); //$NON-NLS-1$
}