}
private static Query createAgeQuery(ISearchCondition condition, String fieldname, String value) {
switch (condition.getSpecifier()) {
case IS: {
return new TermQuery(new Term(fieldname, value));
}
case IS_GREATER_THAN: {
Term lowerBound = new Term(fieldname, MIN_DATE);
Term upperBound = new Term(fieldname, value);
return new ConstantScoreRangeQuery(fieldname, lowerBound.text(), upperBound.text(), false, false);
}
case IS_LESS_THAN: {
Term lowerBound = new Term(fieldname, value);
Term upperBound = new Term(fieldname, MAX_DATE);
return new ConstantScoreRangeQuery(fieldname, lowerBound.text(), upperBound.text(), false, false);
}
}
throw new UnsupportedOperationException("Unsupported Specifier for Age Query"); //$NON-NLS-1$
}