Index Address.district (#4565)
* Index Address.district * Add changelog
This commit is contained in:
parent
428acff31b
commit
7827f65f2d
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 4565
|
||||||
|
title: "The JPA server `Patient:address` SearchParameter did not index values in the
|
||||||
|
element `Address.district`. This has been corrected."
|
|
@ -122,6 +122,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
||||||
private BaseRuntimeChildDefinition myAddressLineValueChild;
|
private BaseRuntimeChildDefinition myAddressLineValueChild;
|
||||||
private BaseRuntimeChildDefinition myAddressCityValueChild;
|
private BaseRuntimeChildDefinition myAddressCityValueChild;
|
||||||
private BaseRuntimeChildDefinition myAddressStateValueChild;
|
private BaseRuntimeChildDefinition myAddressStateValueChild;
|
||||||
|
private BaseRuntimeChildDefinition myAddressDistrictValueChild;
|
||||||
private BaseRuntimeChildDefinition myAddressCountryValueChild;
|
private BaseRuntimeChildDefinition myAddressCountryValueChild;
|
||||||
private BaseRuntimeChildDefinition myAddressPostalCodeValueChild;
|
private BaseRuntimeChildDefinition myAddressPostalCodeValueChild;
|
||||||
private BaseRuntimeChildDefinition myCapabilityStatementRestSecurityServiceValueChild;
|
private BaseRuntimeChildDefinition myCapabilityStatementRestSecurityServiceValueChild;
|
||||||
|
@ -1267,6 +1268,11 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
||||||
allNames.add(city);
|
allNames.add(city);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String district = extractValueAsString(myAddressDistrictValueChild, theValue);
|
||||||
|
if (isNotBlank(district)) {
|
||||||
|
allNames.add(district);
|
||||||
|
}
|
||||||
|
|
||||||
String state = extractValueAsString(myAddressStateValueChild, theValue);
|
String state = extractValueAsString(myAddressStateValueChild, theValue);
|
||||||
if (isNotBlank(state)) {
|
if (isNotBlank(state)) {
|
||||||
allNames.add(state);
|
allNames.add(state);
|
||||||
|
@ -1559,6 +1565,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
||||||
BaseRuntimeElementCompositeDefinition<?> addressDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("Address");
|
BaseRuntimeElementCompositeDefinition<?> addressDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("Address");
|
||||||
myAddressLineValueChild = addressDefinition.getChildByName("line");
|
myAddressLineValueChild = addressDefinition.getChildByName("line");
|
||||||
myAddressCityValueChild = addressDefinition.getChildByName("city");
|
myAddressCityValueChild = addressDefinition.getChildByName("city");
|
||||||
|
myAddressDistrictValueChild = addressDefinition.getChildByName("district");
|
||||||
myAddressStateValueChild = addressDefinition.getChildByName("state");
|
myAddressStateValueChild = addressDefinition.getChildByName("state");
|
||||||
myAddressCountryValueChild = addressDefinition.getChildByName("country");
|
myAddressCountryValueChild = addressDefinition.getChildByName("country");
|
||||||
myAddressPostalCodeValueChild = addressDefinition.getChildByName("postalCode");
|
myAddressPostalCodeValueChild = addressDefinition.getChildByName("postalCode");
|
||||||
|
|
|
@ -8,6 +8,7 @@ import ca.uhn.fhir.rest.param.HasAndListParam;
|
||||||
import ca.uhn.fhir.rest.param.HasOrListParam;
|
import ca.uhn.fhir.rest.param.HasOrListParam;
|
||||||
import ca.uhn.fhir.rest.param.HasParam;
|
import ca.uhn.fhir.rest.param.HasParam;
|
||||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||||
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
import ca.uhn.fhir.rest.param.TokenParam;
|
import ca.uhn.fhir.rest.param.TokenParam;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.hl7.fhir.r5.model.ClinicalUseDefinition;
|
import org.hl7.fhir.r5.model.ClinicalUseDefinition;
|
||||||
|
@ -197,4 +198,27 @@ public class FhirResourceDaoR5SearchNoFtTest extends BaseJpaR5Test {
|
||||||
assertThat(outcome, Matchers.contains(id));
|
assertThat(outcome, Matchers.contains(id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIndexAddressDistrict() {
|
||||||
|
// Setup
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addAddress()
|
||||||
|
.setDistrict("DISTRICT123");
|
||||||
|
String id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
logAllStringIndexes();
|
||||||
|
|
||||||
|
// Test
|
||||||
|
SearchParameterMap params = SearchParameterMap
|
||||||
|
.newSynchronous(Patient.SP_ADDRESS, new StringParam("DISTRICT123"));
|
||||||
|
IBundleProvider outcome = myPatientDao.search(params, mySrd);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
assertThat(toUnqualifiedVersionlessIdValues(outcome), Matchers.contains(id));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue