String message = "Wrong query syntax " + FIELD_NAME
+ ":" + dateTerm + ". Must be standalone 14 digit " +
" IA format date or a range with a hyphen between.";
LOGGER.error(message);
throw new QueryException(message);
}
// So, date is in one of 2 possible formats. First is standalone
// 14 character IA date.
String d = matcher.group(1);
if (d != null)
{
LOGGER.debug("Found single date: " + d);
// This is not a range query. Take the passed date and convert
// it to seconds-since-epoch.
BooleanQuery bq = new BooleanQuery();
bq.add(new TermQuery(getTerm(getSeconds(pad(d)))),
BooleanClause.Occur.SHOULD);
output.add(bq,
(c.isRequired() == true && c.isProhibited() == false)?
BooleanClause.Occur.MUST:
(c.isRequired() == false && c.isProhibited() == false)?
BooleanClause.Occur.SHOULD:
BooleanClause.Occur.MUST_NOT);
continue;
}
// OK, must be 2nd possibility: DIGITS-DIGITS.
String lower = matcher.group(2);
String upper = matcher.group(3);
if (lower != null && upper != null)
{
doRangeQuery(output, c, lower, upper);
continue;
}
String message = "Unparseable query " + dateTerm + " (Is " +
"it in 14 digit IA date format?)";
LOGGER.error(message);
throw new QueryException(message);
}
return output;
}