From a687d7c9c198da3b1515a8e0191cd130b5d8cf49 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Thu, 23 Jan 2020 17:38:59 -0500 Subject: [PATCH] testSearchResourceLinkWithChain is failing --- .../predicate/PredicateBuilderReference.java | 20 ++----------------- .../FhirResourceDaoR4SearchNoHashesTest.java | 2 ++ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java index 68e9618b26e..e6be969980b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/predicate/PredicateBuilderReference.java @@ -364,8 +364,7 @@ class PredicateBuilderReference extends BasePredicateBuilder { Subquery createLinkSubquery(boolean theFoundChainMatch, String theChain, String theSubResourceName, List theOrValues, RequestDetails theRequest) { Subquery subQ = myQueryRoot.subquery(Long.class); - Root subQfrom = subQ.from(ResourceTable.class); - subQ.select(subQfrom.get("myId").as(Long.class)); + subQ.select(myQueryRoot.get("myId").as(Long.class)); List> andOrParams = new ArrayList<>(); andOrParams.add(theOrValues); @@ -584,22 +583,7 @@ class PredicateBuilderReference extends BasePredicateBuilder { } else { throw new InvalidRequestException("Unexpected search parameter type encountered, expected token type for _id search"); } - } -// else if ((searchParam.getName().equals(Constants.PARAM_TAG)) || -// (searchParam.equals(Constants.PARAM_SECURITY))) { -// TokenParam param = new TokenParam(); -// param.setValueAsQueryToken(null, -// null, -// null, -// ((SearchFilterParser.FilterParameter) theFilter).getValue()); -// return addPredicateTag(Collections.singletonList(Collections.singletonList(param)), -// searchParam.getName()); -// } -// else if (searchParam.equals(Constants.PARAM_PROFILE)) { -// addPredicateTag(Collections.singletonList(Collections.singletonList(new UriParam(((SearchFilterParser.FilterParameter) theFilter).getValue()))), -// searchParam.getName()); -// } - else { + } else { RestSearchParameterTypeEnum typeEnum = searchParam.getParamType(); if (typeEnum == RestSearchParameterTypeEnum.URI) { return myPredicateBuilder.addPredicateUri(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new UriParam(theFilter.getValue())), theFilter.getOperation()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java index 9d1bbe51f52..5925cf19008 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java @@ -1821,8 +1821,10 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test { ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", patientId01, patientId02, obsId01, obsId02, drId01); + myCaptureQueriesListener.clear(); List result = toList(myObservationDao .search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChain01")))); + myCaptureQueriesListener.logAllQueriesForCurrentThread(); assertEquals(1, result.size()); assertEquals(obsId01.getIdPart(), result.get(0).getIdElement().getIdPart());