Project

General

Profile

« Previous | Next » 

Revision 57207

Reports always download the first 2000 results. Dedup organizations returned #4588

View differences:

SearchApiService.java
705 705
        try {
706 706
            SearchResult sr = ((SearchServiceImpl)searchService).newSearch(fullQuery, Locale.getDefault().toString(), fields, fieldQueries,0, 0, format, transformer,null,false);
707 707
            logger.debug("Total number of results " + sr.getTotal());
708
            
709
            if (sr.getTotal() > 10000) {
710
                return Response.status(Response.Status.BAD_REQUEST).entity(APIResponseFormatter.
711
                        compose500Message(MediaType.APPLICATION_JSON, "Fail to fetch report.", "You have exceeded the number of allowed returned results")).build();
712
            }
713 708

  
709

  
714 710
        } catch (SearchServiceException sse) {
715 711
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(APIResponseFormatter.
716 712
                    compose500Message(MediaType.APPLICATION_JSON, "Fail to fetch report.", sse.getMessage())).build();
......
851 847
        enhanceQueryWithEntityId(queryBuilder, entity, cleanId(entityId));
852 848
    }
853 849

  
854
    /* Queries with pids are only valid with deleted by inderence marked as true */
850
    /* Queries with pids are only valid with deleted by inference marked as true */
855 851
    private void resultPidQuery(StringBuilder queryBuilder, RequestResponseHandler.Entity entity, String resultPid, List<String> fieldQueries){
856 852
        builtDeletedByInferenceQuery(queryBuilder);
857
        if (entity == RequestResponseHandler.Entity.ORGANIZATION) {
858
            enhanceFieldQueryWithEntityType(entity, fieldQueries);
859
        } else if (entity != RequestResponseHandler.Entity.NONE) {
853

  
854
        if (entity != RequestResponseHandler.Entity.NONE && entity != RequestResponseHandler.Entity.ORGANIZATION) {
860 855
            throw new IllegalArgumentException("Entity " + entity.toString() + " is not supported.");
861 856
        }
862 857
        enhanceQueryWithPid(queryBuilder, entity, cleanId(resultPid));

Also available in: Unified diff