Add configuration flag to enable storing of resources in lucene index (#304)
* Add configuration flag to enable storing of resources in lucene index * Fix build issue * Fix code review suggestions Co-authored-by: Jaison B <jaison.baskaran@smilecdr.com>
This commit is contained in:
@@ -354,10 +354,14 @@ elasticsearch.schema_management_strategy=CREATE
|
|||||||
|
|
||||||
Set `hapi.fhir.lastn_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable the $lastn operation on this server. Note that the $lastn operation relies on Elasticsearch, so for $lastn to work, indexing must be enabled using Elasticsearch.
|
Set `hapi.fhir.lastn_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable the $lastn operation on this server. Note that the $lastn operation relies on Elasticsearch, so for $lastn to work, indexing must be enabled using Elasticsearch.
|
||||||
|
|
||||||
|
## Enabling Resource to be stored in Lucene Index
|
||||||
|
|
||||||
|
Set `hapi.fhir.store_resource_in_lucene_index_enabled` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable storing of resource json along with Lucene/Elasticsearch index mappings.
|
||||||
|
|
||||||
## Changing cached search results time
|
## Changing cached search results time
|
||||||
|
|
||||||
It is possible to change the cached search results time. The option `reuse_cached_search_results_millis` in the [application.yaml] is 6000 miliseconds by default.
|
It is possible to change the cached search results time. The option `reuse_cached_search_results_millis` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) is 6000 miliseconds by default.
|
||||||
Set `reuse_cached_search_results_millis: -1` in the [application.yaml] file to ignore the cache time every search.
|
Set `reuse_cached_search_results_millis: -1` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to ignore the cache time every search.
|
||||||
|
|
||||||
## Build the distroless variant of the image (for lower footprint and improved security)
|
## Build the distroless variant of the image (for lower footprint and improved security)
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class AppProperties {
|
|||||||
private Map<String, ImplementationGuide> implementationGuides = null;
|
private Map<String, ImplementationGuide> implementationGuides = null;
|
||||||
|
|
||||||
private Boolean lastn_enabled = false;
|
private Boolean lastn_enabled = false;
|
||||||
|
private boolean store_resource_in_lucene_index_enabled = false;
|
||||||
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
||||||
|
|
||||||
private Integer search_coord_core_pool_size = 20;
|
private Integer search_coord_core_pool_size = 20;
|
||||||
@@ -469,6 +470,14 @@ public class AppProperties {
|
|||||||
this.lastn_enabled = lastn_enabled;
|
this.lastn_enabled = lastn_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getStore_resource_in_lucene_index_enabled() {
|
||||||
|
return store_resource_in_lucene_index_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStore_resource_in_lucene_index_enabled(Boolean store_resource_in_lucene_index_enabled) {
|
||||||
|
this.store_resource_in_lucene_index_enabled = store_resource_in_lucene_index_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public NormalizedQuantitySearchLevel getNormalized_quantity_search_level() {
|
public NormalizedQuantitySearchLevel getNormalized_quantity_search_level() {
|
||||||
return this.normalized_quantity_search_level;
|
return this.normalized_quantity_search_level;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,8 +407,8 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
|||||||
daoConfig.setLastNEnabled(true);
|
daoConfig.setLastNEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daoConfig.setStoreResourceInLuceneIndex(appProperties.getStore_resource_in_lucene_index_enabled());
|
||||||
daoConfig.getModelConfig().setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
daoConfig.getModelConfig().setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
||||||
|
|
||||||
daoConfig.getModelConfig().setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
daoConfig.getModelConfig().setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHan
|
|||||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
|
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
|
||||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
|
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
|
||||||
import ca.uhn.fhir.rest.server.mail.MailConfig;
|
import ca.uhn.fhir.rest.server.mail.MailConfig;
|
||||||
|
import ca.uhn.fhir.rest.server.mail.MailSvc;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.dstu2.model.Subscription;
|
import org.hl7.fhir.dstu2.model.Subscription;
|
||||||
@@ -225,10 +226,9 @@ public class FhirServerConfigCommon {
|
|||||||
mailConfig.setSmtpPassword(email.getPassword());
|
mailConfig.setSmtpPassword(email.getPassword());
|
||||||
mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable());
|
mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable());
|
||||||
|
|
||||||
IEmailSender emailSender = new EmailSenderImpl(mailConfig);
|
IEmailSender emailSender = new EmailSenderImpl(new MailSvc(mailConfig));
|
||||||
|
|
||||||
if(subscriptionDeliveryHandlerFactory.isPresent())
|
subscriptionDeliveryHandlerFactory.ifPresent(theSubscriptionDeliveryHandlerFactory -> theSubscriptionDeliveryHandlerFactory.setEmailSender(emailSender));
|
||||||
subscriptionDeliveryHandlerFactory.get().setEmailSender(emailSender);
|
|
||||||
|
|
||||||
return emailSender;
|
return emailSender;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ hapi:
|
|||||||
# startTlsRequired:
|
# startTlsRequired:
|
||||||
# quitWait:
|
# quitWait:
|
||||||
# lastn_enabled: true
|
# lastn_enabled: true
|
||||||
|
# store_resource_in_lucene_index_enabled: true
|
||||||
### This is configuration for normalized quantity serach level default is 0
|
### This is configuration for normalized quantity serach level default is 0
|
||||||
### 0: NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED - default
|
### 0: NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED - default
|
||||||
### 1: NORMALIZED_QUANTITY_STORAGE_SUPPORTED
|
### 1: NORMALIZED_QUANTITY_STORAGE_SUPPORTED
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
|||||||
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
"spring.datasource.url=jdbc:h2:mem:dbr4",
|
||||||
"hapi.fhir.fhir_version=r4",
|
"hapi.fhir.fhir_version=r4",
|
||||||
"hapi.fhir.lastn_enabled=true",
|
"hapi.fhir.lastn_enabled=true",
|
||||||
|
"hapi.fhir.store_resource_in_lucene_index_enabled=true",
|
||||||
"elasticsearch.enabled=true",
|
"elasticsearch.enabled=true",
|
||||||
// Because the port is set randomly, we will set the rest_url using the Initializer.
|
// Because the port is set randomly, we will set the rest_url using the Initializer.
|
||||||
// "elasticsearch.rest_url='http://localhost:9200'",
|
// "elasticsearch.rest_url='http://localhost:9200'",
|
||||||
|
|||||||
Reference in New Issue
Block a user