Try to speed up terminology reindexing

This commit is contained in:
James Agnew 2017-08-24 15:04:53 -04:00
parent dbe35b9be2
commit 18213f1af9
2 changed files with 15 additions and 5 deletions

View File

@ -396,6 +396,17 @@ public abstract class BaseHapiTerminologySvc implements IHapiTerminologySvc {
if (myChildToParentPidCache == null) { if (myChildToParentPidCache == null) {
myChildToParentPidCache = ArrayListMultimap.create(); myChildToParentPidCache = ArrayListMultimap.create();
ourLog.info("Filling terminology parent/child cache");
int count = 0;
for (TermConceptParentChildLink next : myConceptParentChildLinkDao.findAll()) {
myChildToParentPidCache.put(next.getChildPid(), next.getParentPid());
if (count++ % 1000 == 0) {
ourLog.info("Loaded {} links", count);
}
}
ourLog.info("Done filling terminology parent/child cache");
} }
ourLog.info("Indexing {} / {} concepts", concepts.getContent().size(), concepts.getTotalElements()); ourLog.info("Indexing {} / {} concepts", concepts.getContent().size(), concepts.getTotalElements());

View File

@ -88,15 +88,14 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
} }
@Test @Test
public void testCreateResource() throws IOException { public void testCreateResource() throws IOException, ServletException {
String methodName = "testCreateResource"; String methodName = "testCreateResource";
Patient pt = new Patient(); Patient pt = new Patient();
pt.addName().setFamily(methodName); pt.addName().setFamily(methodName);
String resource = myFhirCtx.newXmlParser().encodeResourceToString(pt); String resource = myFhirCtx.newXmlParser().encodeResourceToString(pt);
verify(myServerInterceptor, never()).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class)); resetServerInterceptor();
verify(myDaoInterceptor, never()).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class));
HttpPost post = new HttpPost(ourServerBase + "/Patient"); HttpPost post = new HttpPost(ourServerBase + "/Patient");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
@ -127,7 +126,7 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
} }
@Test @Test
public void testCreateResourceInTransaction() throws IOException { public void testCreateResourceInTransaction() throws IOException, ServletException {
String methodName = "testCreateResourceInTransaction"; String methodName = "testCreateResourceInTransaction";
Patient pt = new Patient(); Patient pt = new Patient();
@ -143,7 +142,7 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
String resource = myFhirCtx.newXmlParser().encodeResourceToString(bundle); String resource = myFhirCtx.newXmlParser().encodeResourceToString(bundle);
verify(myServerInterceptor, never()).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class)); resetServerInterceptor();
HttpPost post = new HttpPost(ourServerBase + "/"); HttpPost post = new HttpPost(ourServerBase + "/");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));