This commit is contained in:
Ken Stevens 2019-11-13 15:58:57 -05:00 committed by James Agnew
parent 25c094e38a
commit f11d939131
2 changed files with 7 additions and 8 deletions

View File

@ -40,6 +40,7 @@ import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
import ca.uhn.fhir.rest.api.SummaryEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails; import ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -962,8 +963,12 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
* *
* before doing anything else. * before doing anything else.
*/ */
boolean wantOnlyCount = myParams.wantOnlyCount(myDaoConfig.getDefaultTotalMode()); boolean wantOnlyCount = SummaryEnum.COUNT.equals(myParams.getSummaryMode());
if (wantOnlyCount) { boolean wantCount =
wantOnlyCount ||
SearchTotalModeEnum.ACCURATE.equals(myParams.getSearchTotalMode()) ||
(myParams.getSearchTotalMode() == null && SearchTotalModeEnum.ACCURATE.equals(myDaoConfig.getDefaultTotalMode()));
if (wantCount) {
ourLog.trace("Performing count"); ourLog.trace("Performing count");
ISearchBuilder sb = newSearchBuilder(); ISearchBuilder sb = newSearchBuilder();
Iterator<Long> countIterator = sb.createCountQuery(myParams, mySearch.getUuid(), myRequest); Iterator<Long> countIterator = sb.createCountQuery(myParams, mySearch.getUuid(), myRequest);

View File

@ -495,12 +495,6 @@ public class SearchParameterMap implements Serializable {
} }
} }
public boolean wantOnlyCount(SearchTotalModeEnum theDefaultTotalMode) {
return SummaryEnum.COUNT.equals(mySummaryMode) ||
SearchTotalModeEnum.ACCURATE.equals(mySearchTotalMode) ||
(mySearchTotalMode == null && SearchTotalModeEnum.ACCURATE.equals(theDefaultTotalMode));
}
public enum EverythingModeEnum { public enum EverythingModeEnum {
/* /*
* Don't reorder! We rely on the ordinals * Don't reorder! We rely on the ordinals