Skip to content

Commit

Permalink
Backport for 7.4.2 (#6303)
Browse files Browse the repository at this point in the history
* version bumps and change log

* cherry pick 6420

* various updates to changelogs

* build formatting changes

---------

Co-authored-by: jdar <[email protected]>
Co-authored-by: Etienne Poirier <[email protected]>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent 1b006bb commit a76c141
Show file tree
Hide file tree
Showing 92 changed files with 535 additions and 139 deletions.
2 changes: 1 addition & 1 deletion hapi-deployable-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
* #L%
*/

import com.google.common.collect.Streams;
import jakarta.annotation.Nonnull;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;
Expand Down Expand Up @@ -57,4 +59,9 @@ public void chunk(Collection<T> theInput, int theChunkSize, Consumer<List<T>> th
public <T> Stream<List<T>> chunk(Stream<T> theStream, int theChunkSize) {
return StreamUtil.partition(theStream, theChunkSize);
}

@Nonnull
public void chunk(Iterator<T> theIterator, int theChunkSize, Consumer<List<T>> theListConsumer) {
chunk(Streams.stream(theIterator), theChunkSize).forEach(theListConsumer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ public enum VersionEnum {

V7_3_0,
V7_4_0,
V7_4_1;
V7_4_1,
V7_4_2;

public static VersionEnum latestVersion() {
VersionEnum[] values = VersionEnum.values();
Expand Down
35 changes: 33 additions & 2 deletions hapi-fhir-base/src/test/java/ca/uhn/fhir/util/TaskChunkerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
import jakarta.annotation.Nonnull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -43,8 +50,32 @@ public void testChunk() {

@Nonnull
private static List<Integer> newIntRangeList(int startInclusive, int endExclusive) {
List<Integer> input = IntStream.range(startInclusive, endExclusive).boxed().toList();
return input;
return IntStream.range(startInclusive, endExclusive).boxed().toList();
}

@ParameterizedTest
@MethodSource("testIteratorChunkArguments")
void testIteratorChunk(List<Integer> theListToChunk, List<List<Integer>> theExpectedChunks) {
// given
Iterator<Integer> iter = theListToChunk.iterator();
ArrayList<List<Integer>> result = new ArrayList<>();

// when
new TaskChunker<Integer>().chunk(iter, 3, result::add);

// then
assertEquals(theExpectedChunks, result);
}

public static Stream<Arguments> testIteratorChunkArguments() {
return Stream.of(
Arguments.of(Collections.emptyList(), Collections.emptyList()),
Arguments.of(List.of(1), List.of(List.of(1))),
Arguments.of(List.of(1,2), List.of(List.of(1,2))),
Arguments.of(List.of(1,2,3), List.of(List.of(1,2,3))),
Arguments.of(List.of(1,2,3,4), List.of(List.of(1,2,3), List.of(4))),
Arguments.of(List.of(1,2,3,4,5,6,7,8,9), List.of(List.of(1,2,3), List.of(4,5,6), List.of(7,8,9)))
);
}

}
4 changes: 2 additions & 2 deletions hapi-fhir-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>

<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-checkstyle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client-okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
release-date: "2024-09-20"
codename: "Copernicus"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
type: fix
issue: 6216
jira: SMILE-8806
title: "Previously, searches combining the `_text` query parameter (using Lucene/Elasticsearch) with query parameters
using the database (e.g. `identifier` or `date`) could miss matches when more than 500 results match the `_text` query
parameter. This has been fixed, but may be slow if many results match the `_text` query and must be checked against the
database parameters."
2 changes: 1 addition & 1 deletion hapi-fhir-jacoco/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jaxrsserver-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.4.1-SNAPSHOT</version>
<version>7.4.2</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchSearchBuilder;
import ca.uhn.fhir.jpa.dao.search.IHSearchSortHelper;
import ca.uhn.fhir.jpa.dao.search.LastNOperation;
import ca.uhn.fhir.jpa.dao.search.SearchScrollQueryExecutorAdaptor;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.search.ExtendedHSearchBuilderConsumeAdvancedQueryClausesParams;
Expand All @@ -40,6 +41,7 @@
import ca.uhn.fhir.jpa.search.autocomplete.ValueSetAutocompleteOptions;
import ca.uhn.fhir.jpa.search.autocomplete.ValueSetAutocompleteSearch;
import ca.uhn.fhir.jpa.search.builder.ISearchQueryExecutor;
import ca.uhn.fhir.jpa.search.builder.SearchBuilder;
import ca.uhn.fhir.jpa.search.builder.SearchQueryExecutors;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
Expand Down Expand Up @@ -183,6 +185,19 @@ public ISearchQueryExecutor searchNotScrolled(
return doSearch(theResourceName, theParams, null, theMaxResultsToFetch, theRequestDetails);
}

@Transactional
@Override
public ISearchQueryExecutor searchScrolled(
String theResourceType, SearchParameterMap theParams, RequestDetails theRequestDetails) {
validateHibernateSearchIsEnabled();

SearchQueryOptionsStep<?, Long, SearchLoadingOptionsStep, ?, ?> searchQueryOptionsStep =
getSearchQueryOptionsStep(theResourceType, theParams, null);
logQuery(searchQueryOptionsStep, theRequestDetails);

return new SearchScrollQueryExecutorAdaptor(searchQueryOptionsStep.scroll(SearchBuilder.getMaximumPageSize()));
}

// keep this in sync with supportsSomeOf();
@SuppressWarnings("rawtypes")
private ISearchQueryExecutor doSearch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ ISearchQueryExecutor searchNotScrolled(
Integer theMaxResultsToFetch,
RequestDetails theRequestDetails);

/**
* Query the index for a complete iterator of ALL results. (scrollable search result).
*
* @param theResourceName e.g. Patient
* @param theParams The search query
* @param theRequestDetails The request details
* @return Iterator of result PIDs
*/
ISearchQueryExecutor searchScrolled(
String theResourceName, SearchParameterMap theParams, RequestDetails theRequestDetails);

/**
* Autocomplete search for NIH $expand contextDirection=existing
* @param theOptions operation options
Expand Down
Loading

0 comments on commit a76c141

Please sign in to comment.