// TODO: このへんの定数なんとかするべき。いろんなところに散らばっていて使いにくい。
Sort sort;
if ("score".equals(sortOrder)) {
sort = new Sort(SortField.FIELD_SCORE, new SortField("BEGIN-TIME", SortField.STRING));
} else if ("createdAt".equals(sortOrder)) {
sort = new Sort(new SortField("CREATED-AT", SortField.STRING, true));
} else if ("deadline".equals(sortOrder)) {
sort = new Sort(new SortField("DEADLINE-TIME", SortField.STRING));
} else if ("deadline-r".equals(sortOrder)) {
sort = new Sort(new SortField("DEADLINE-TIME", SortField.STRING, true));
} else if ("beginDate".equals(sortOrder)) {
sort = new Sort(new SortField("BEGIN-TIME", SortField.STRING));
} else if ("beginDate-r".equals(sortOrder)) {
sort = new Sort(new SortField("BEGIN-TIME", SortField.STRING, true));
} else {
// 決まってない場合は、score 順にする。
sort = new Sort(SortField.FIELD_SCORE, new SortField("BEGIN-TIME", SortField.STRING));
}
return indexSearcher.search(query, filter, maxDocument, sort);
} catch (IOException e) {
throw new EventSearchServiceException(e);