}
else if (clause.getQuery() instanceof PhraseQuery) { // add phrase
lclausesInside.add(clause);
}
else if (clause.getQuery() instanceof PwaClosestQuery) { // add filter - date closest
PwaClosestQuery query = (PwaClosestQuery)clause.getQuery();
filters.add(new PwaDateClosestFilter(reader, query.getText()));
scoreType=ScoreType.ONLY_ONE; // only one result, so it does not need to rank
}
else if (clause.getQuery() instanceof RangeQuery) { // add filter - date range
RangeQuery query = (RangeQuery)clause.getQuery();
filters.add(new PwaDateRangeFilter(reader, query.getLowerTerm().text(), query.getUpperTerm().text()));
}
else if (clause.getQuery() instanceof PwaSortQuery) { // add filter - sort results by date
PwaSortQuery query = (PwaSortQuery)clause.getQuery();
if (query.getField().equals("date")) { // it does not need to rank by score, because results are sorted by date
if (query.getReverse()) {
scoreType=ScoreType.DATE_SORTED_REVERSE;
}
else {
scoreType=ScoreType.DATE_SORTED;
}