diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java index 850db1ceeb4..a5bfbc6fb8f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java @@ -373,6 +373,11 @@ public class DaoConfig { * This feature may be enabled on servers where supporting the use of the :missing parameter is * of higher importance than raw write performance *

+ *

+ * Note that this setting also has an impact on sorting (i.e. using the + * _sort parameter on searches): If the server is configured + * to not index missing field. + *

*/ public void setIndexMissingFields(IndexEnabledEnum theIndexMissingFields) { Validate.notNull(theIndexMissingFields, "theIndexMissingFields must not be null"); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java index 095ca6c39fd..0ba5259d270 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java @@ -67,6 +67,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu2"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu2"); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); + retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java index 1f5dcb028d0..845433ba7bd 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java @@ -56,6 +56,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu3"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu3"); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); + retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); return retVal; } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java index ba0860169a1..635381f0563 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java @@ -74,6 +74,27 @@ public class JsonParserDstu2Test { } } + @Test + public void testParseEmptyString() { + try { + String tmp = "{\"resourceType\":\"Bundle\",\"entry\":[{\"fullUrl\":\"\",\"resource\":{\"resourceType\":\"Patient\",\"id\":\"patxuzos\"}}]}"; + ourCtx.getParserOptions().setOverrideResourceIdWithBundleEntryFullUrl(false); + ca.uhn.fhir.model.dstu2.resource.Bundle bundle = (ca.uhn.fhir.model.dstu2.resource.Bundle) ourCtx.newJsonParser().parseResource(tmp); + assertEquals(1, bundle.getEntry().size()); + { + Patient o1 = (Patient) bundle.getEntry().get(0).getResource(); + IIdType o1Id = o1.getIdElement(); + assertFalse(o1Id.hasBaseUrl()); + assertEquals("Patient", o1Id.getResourceType()); + assertEquals("patxuzos", o1Id.getIdPart()); + assertFalse(o1Id.hasVersionIdPart()); + } + } finally { + // ensure we cleanup ourCtx so other tests continue to work + ourCtx = FhirContext.forDstu2(); + } + } + @Test public void testOverrideResourceIdWithBundleEntryFullUrlDisabled_ConfiguredOnParser() { try {