Skip to content

Commit 48a141b

Browse files
authored
Merge pull request #742 from hapifhir/expose-search-prefetch-thresholds
Expose Setting for prefetch thresholds
2 parents 3066622 + 96f9089 commit 48a141b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public class AppProperties {
105105
private final List<String> custom_provider_classes = new ArrayList<>();
106106
private Boolean upliftedRefchains_enabled = false;
107107

108+
private List<Integer> search_prefetch_thresholds = new ArrayList<>();
109+
108110

109111
public List<String> getCustomInterceptorClasses() {
110112
return custom_interceptor_classes;
@@ -644,6 +646,14 @@ public void setLanguage_search_parameter_enabled(Boolean language_search_paramet
644646
this.language_search_parameter_enabled = language_search_parameter_enabled;
645647
}
646648

649+
public List<Integer> getSearch_prefetch_thresholds() {
650+
return this.search_prefetch_thresholds;
651+
}
652+
653+
public void setSearch_prefetch_thresholds(List<Integer> thePrefetchThresholds) {
654+
this.search_prefetch_thresholds = thePrefetchThresholds;
655+
}
656+
647657
public boolean getUpliftedRefchains_enabled() {
648658
return upliftedRefchains_enabled;
649659
}

src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
152152
jpaStorageSettings.setIndexOnUpliftedRefchains(appProperties.getUpliftedRefchains_enabled());
153153

154154

155+
if (!appProperties.getSearch_prefetch_thresholds().isEmpty()) {
156+
jpaStorageSettings.setSearchPreFetchThresholds(appProperties.getSearch_prefetch_thresholds());
157+
}
158+
155159
Integer maxFetchSize = appProperties.getMax_page_size();
156160
jpaStorageSettings.setFetchSizeDefaultMaximum(maxFetchSize);
157161
ourLog.info("Server configured to have a maximum fetch size of "

src/main/resources/application.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,18 @@ hapi:
236236
search-coord-core-pool-size: 20
237237
search-coord-max-pool-size: 100
238238
search-coord-queue-capacity: 200
239-
239+
240+
# Search Prefetch Thresholds.
241+
242+
# This setting sets the number of search results to prefetch. For example, if this list
243+
# is set to [100, 1000, -1] then the server will initially load 100 results and not
244+
# attempt to load more. If the user requests subsequent page(s) of results and goes
245+
# past 100 results, the system will load the next 900 (up to the following threshold of 1000).
246+
# The system will progressively work through these thresholds.
247+
# A threshold of -1 means to load all results. Note that if the final threshold is a
248+
# number other than -1, the system will never prefetch more than the given number.
249+
search_prefetch_thresholds: 13,503,2003,-1
250+
240251
# comma-separated package names, will be @ComponentScan'ed by Spring to allow for creating custom Spring beans
241252
#custom-bean-packages:
242253

0 commit comments

Comments
 (0)