This commit is contained in:
Ken Stevens 2020-01-23 15:58:13 -05:00
parent d2ef5555fe
commit 48a71d6649
1 changed files with 9 additions and 11 deletions

View File

@ -148,11 +148,6 @@ public class SearchBuilder implements ISearchBuilder {
myDontUseHashesForSearch = myDaoConfig.getDisableHashBasedSearches();
}
@PostConstruct
public void postConstruct() {
myPredicateBuilder = new PredicateBuilder(this, myPredicateBuilderFactory);
}
@Override
public void setMaxResultsToFetch(Integer theMaxResultsToFetch) {
myMaxResultsToFetch = theMaxResultsToFetch;
@ -192,9 +187,7 @@ public class SearchBuilder implements ISearchBuilder {
@Override
public Iterator<Long> createCountQuery(SearchParameterMap theParams, String theSearchUuid, RequestDetails theRequest) {
myParams = theParams;
myBuilder = myEntityManager.getCriteriaBuilder();
mySearchUuid = theSearchUuid;
init(theParams, theSearchUuid);
TypedQuery<Long> query = createQuery(null, null, true, theRequest);
return new CountQueryIterator(query);
@ -210,9 +203,7 @@ public class SearchBuilder implements ISearchBuilder {
@Override
public IResultIterator createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, RequestDetails theRequest) {
myParams = theParams;
myBuilder = myEntityManager.getCriteriaBuilder();
mySearchUuid = theSearchRuntimeDetails.getSearchUuid();
init(theParams, theSearchRuntimeDetails.getSearchUuid());
if (myPidSet == null) {
myPidSet = new HashSet<>();
@ -221,6 +212,13 @@ public class SearchBuilder implements ISearchBuilder {
return new QueryIterator(theSearchRuntimeDetails, theRequest);
}
private void init(SearchParameterMap theParams, String theTheSearchUuid) {
myParams = theParams;
myBuilder = myEntityManager.getCriteriaBuilder();
mySearchUuid = theTheSearchUuid;
myPredicateBuilder = new PredicateBuilder(this, myPredicateBuilderFactory);
}
private TypedQuery<Long> createQuery(SortSpec sort, Integer theMaximumResults, boolean theCount, RequestDetails theRequest) {
CriteriaQuery<Long> outerQuery;
/*