use of org.obiba.mica.spi.search.support.EmptyQuery in project mica2 by obiba.
the class AbstractDocumentQuery method createStudyIdQuery.
private Query createStudyIdQuery(List<String> studyIds) {
if (studyIds == null || studyIds.isEmpty()) {
return query.isEmpty() ? new EmptyQuery() : query;
}
List<String> joinFields = getJoinFields();
String joinedStudyIds = Joiner.on(",").join(studyIds);
String rql;
if (joinFields.size() == 1) {
rql = String.format("in(%s,(%s))", joinFields.get(0), joinedStudyIds);
} else {
rql = String.format("or(%s)", joinFields.stream().map(field -> String.format("in(%s,(%s))", field, joinedStudyIds)).collect(Collectors.joining(",")));
}
// return searcher.makeQuery(String.format("%s,limit(%s,%s)", rql, query.getFrom(), query.getSize()));
return searcher.makeQuery(rql);
}
Aggregations