Search in sources :

Example 1 with DocumentQueryInterface

use of org.obiba.mica.search.queries.DocumentQueryInterface 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;
}
Also used : JoinQueryResultDto(org.obiba.mica.web.model.MicaSearch.JoinQueryResultDto) LocalizedString(org.obiba.mica.core.domain.LocalizedString) DocumentQueryInterface(org.obiba.mica.search.queries.DocumentQueryInterface) CountStatsData(org.obiba.mica.spi.search.CountStatsData)

Aggregations

LocalizedString (org.obiba.mica.core.domain.LocalizedString)1 DocumentQueryInterface (org.obiba.mica.search.queries.DocumentQueryInterface)1 CountStatsData (org.obiba.mica.spi.search.CountStatsData)1 JoinQueryResultDto (org.obiba.mica.web.model.MicaSearch.JoinQueryResultDto)1