fixed name text indexing (#2309)
* fixed name text indexing * fixed name text indexing
This commit is contained in:
parent
feff734736
commit
749934d5f1
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: fix
|
||||
issue: 2309
|
||||
title: "In the JPA server, HumanName.name.text was not being indexed and therefore was not searchable. This has been corrected."
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r4.model.Coding;
|
|||
import org.hl7.fhir.r4.model.Consent;
|
||||
import org.hl7.fhir.r4.model.Encounter;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.HumanName;
|
||||
import org.hl7.fhir.r4.model.Observation;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.hl7.fhir.r4.model.Quantity;
|
||||
|
@ -50,6 +51,8 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Comparator.comparing;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
|
@ -82,6 +85,19 @@ public class SearchParamExtractorR4Test {
|
|||
assertEquals("CODE", token.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testName() {
|
||||
Patient patient = new Patient();
|
||||
HumanName humanName = patient.addName();
|
||||
humanName.addGiven("Jimmy");
|
||||
humanName.setFamily("Jones");
|
||||
humanName.setText("Jimmy Jones");
|
||||
SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry);
|
||||
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamString> stringSearchParams = extractor.extractSearchParamStrings(patient);
|
||||
List<String> nameValues = stringSearchParams.stream().filter(param -> "name".equals(param.getParamName())).map(ResourceIndexedSearchParamString::getValueExact).collect(Collectors.toList());
|
||||
assertThat(nameValues, containsInAnyOrder("Jimmy", "Jones", "Jimmy Jones"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenOnSearchParamContext() {
|
||||
SearchParameter sp = new SearchParameter();
|
||||
|
|
|
@ -132,6 +132,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
private BaseRuntimeChildDefinition myDurationValueValueChild;
|
||||
private BaseRuntimeChildDefinition myHumanNameFamilyValueChild;
|
||||
private BaseRuntimeChildDefinition myHumanNameGivenValueChild;
|
||||
private BaseRuntimeChildDefinition myHumanNameTextValueChild;
|
||||
private BaseRuntimeChildDefinition myContactPointValueValueChild;
|
||||
private BaseRuntimeChildDefinition myIdentifierSystemValueChild;
|
||||
private BaseRuntimeChildDefinition myIdentifierValueValueChild;
|
||||
|
@ -877,6 +878,10 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
for (String next : givens) {
|
||||
createStringIndexIfNotBlank(theResourceType, theParams, theSearchParam, next);
|
||||
}
|
||||
List<String> texts = extractValuesAsStrings(myHumanNameTextValueChild, theValue);
|
||||
for (String next : texts) {
|
||||
createStringIndexIfNotBlank(theResourceType, theParams, theSearchParam, next);
|
||||
}
|
||||
}
|
||||
|
||||
private void addString_Quantity(String theResourceType, Set<ResourceIndexedSearchParamString> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
|
||||
|
@ -1138,6 +1143,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
BaseRuntimeElementCompositeDefinition<?> humanNameDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("HumanName");
|
||||
myHumanNameFamilyValueChild = humanNameDefinition.getChildByName("family");
|
||||
myHumanNameGivenValueChild = humanNameDefinition.getChildByName("given");
|
||||
myHumanNameTextValueChild = humanNameDefinition.getChildByName("text");
|
||||
|
||||
BaseRuntimeElementCompositeDefinition<?> contactPointDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("ContactPoint");
|
||||
myContactPointValueValueChild = contactPointDefinition.getChildByName("value");
|
||||
|
|
Loading…
Reference in New Issue