From 2bc31812187933d599d7fde5cf751e79cb559bec Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Sat, 25 Jan 2020 13:30:26 -0500 Subject: [PATCH] ensure in-memory matching location search for Dstu3 falls back to a db search --- .../uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java | 3 ++- .../fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java | 3 +++ .../module/matcher/InMemorySubscriptionMatcherR3Test.java | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java index 7bef0a721ae..737b46b859e 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java @@ -26,8 +26,9 @@ public class InMemoryMatchResult { public static final String CHAIN = "Chained parameters are not supported"; public static final String PARAM = "Parameter not supported"; public static final String QUALIFIER = "Qualified parameter not supported"; + public static final String LOCATION_NEAR = "Location.position near not supported"; - private final boolean myMatch; + private final boolean myMatch; private final boolean mySupported; private final String myUnsupportedParameter; private final String myUnsupportedReason; diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java index e88f3ce00e5..c93c5e14ba8 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java @@ -88,6 +88,9 @@ public class InMemoryResourceMatcher { if (searchParameterMap.getLastUpdated() != null) { return InMemoryMatchResult.unsupportedFromParameterAndReason(Constants.PARAM_LASTUPDATED, InMemoryMatchResult.STANDARD_PARAMETER); } + if (searchParameterMap.getNearDistanceParam() != null) { + return InMemoryMatchResult.unsupportedFromReason(InMemoryMatchResult.LOCATION_NEAR); + } for (Map.Entry>> entry : searchParameterMap.entrySet()) { String theParamName = entry.getKey(); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java index bc5c73587a2..82c9384d4de 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java @@ -626,7 +626,6 @@ public class InMemorySubscriptionMatcherR3Test extends BaseSubscriptionDstu3Test assertNotMatched(patient, badCriteria4); } - // FIXME KHS fix this test @Test public void testLocationPositionNotSupported() { Location loc = new Location(); @@ -641,6 +640,6 @@ public class InMemorySubscriptionMatcherR3Test extends BaseSubscriptionDstu3Test "&" + Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + "|http://unitsofmeasure.org|km"; - assertMatched(loc, badCriteria); + assertUnsupported(loc, badCriteria); } }