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