use of org.obiba.mica.spi.search.CountStatsData in project mica2 by obiba.
the class JoinQueryExecutor method doQueries.
private JoinQueryResultDto doQueries(QueryType type, JoinQuery joinQuery, CountStatsData.Builder countBuilder, QueryScope scope) {
boolean queriesHaveFilters = Stream.of(variableQuery, datasetQuery, studyQuery, networkQuery).anyMatch(DocumentQueryInterface::hasQueryBuilder);
if (queriesHaveFilters) {
DocumentQueryIdProvider datasetIdProvider = new DocumentQueryIdProvider();
variableQuery.setDatasetIdProvider(datasetIdProvider);
datasetQuery.setDatasetIdProvider(datasetIdProvider);
List<String> joinedIds = executeJoin(type);
CountStatsData countStats = countBuilder != null ? getCountStatsData(type) : null;
if ((joinQuery.searchOnNetworksOnly() && QueryType.NETWORK.equals(type)) || (joinedIds != null && joinedIds.size() > 0)) {
getDocumentQuery(type).query((joinQuery.searchOnNetworksOnly() && QueryType.NETWORK.equals(type)) ? Collections.emptyList() : joinedIds, countStats, scope);
}
} else {
execute(type, scope, countBuilder);
}
log.debug("Building result");
JoinQueryResultDto resultDto = buildQueryResult(joinQuery);
log.debug("Finished query");
return resultDto;
}
use of org.obiba.mica.spi.search.CountStatsData in project mica2 by obiba.
the class JoinQueryExecutor method execute.
private void execute(QueryType type, QueryScope scope, CountStatsData.Builder countBuilder) {
CountStatsData countStats;
switch(type) {
case VARIABLE:
queryAggregations(null, studyQuery, datasetQuery, networkQuery);
countStats = countBuilder != null ? getCountStatsData(type) : null;
variableQuery.query(null, countStats, scope);
break;
case DATASET:
queryAggregations(null, variableQuery, studyQuery, networkQuery);
countStats = countBuilder != null ? getCountStatsData(type) : null;
datasetQuery.query(null, countStats, scope);
break;
case STUDY:
queryAggregations(null, variableQuery, datasetQuery, networkQuery);
countStats = countBuilder != null ? getCountStatsData(type) : null;
studyQuery.query(null, countStats, scope);
break;
case NETWORK:
queryAggregations(null, variableQuery, datasetQuery, studyQuery);
countStats = countBuilder != null ? getCountStatsData(type) : null;
networkQuery.query(null, countStats, scope);
break;
}
}
Aggregations