Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAPI FHIR Dependency Bumps #5576

Merged
merged 28 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1691b50
HAPI FHIR Dependency Bumps
jamesagnew Jan 2, 2024
6d34af6
Hibernate search 6
jamesagnew Jan 2, 2024
284f7db
Dep bumps
jamesagnew Jan 2, 2024
76b9de5
Bump mockito
jamesagnew Jan 3, 2024
b50d736
Fix memory leak
jamesagnew Jan 3, 2024
fc9c32b
Test cleanup
jamesagnew Jan 3, 2024
8f82c60
Test fix
jamesagnew Jan 3, 2024
c57faa2
Test fixes
jamesagnew Jan 4, 2024
6eb812f
Test fix
jamesagnew Jan 4, 2024
ab19b08
Test fix
jamesagnew Jan 4, 2024
20daf25
Test fix
jamesagnew Jan 4, 2024
ac8f83c
Test fix
jamesagnew Jan 4, 2024
9cbb6e7
Prepare to try and rework max clauses
jamesagnew Jan 5, 2024
00278d1
Refactor large VS expansion
jamesagnew Jan 5, 2024
80e9c57
Spotless
jamesagnew Jan 5, 2024
47c9bf8
Test fix
jamesagnew Jan 5, 2024
0f22b5a
Merge branch 'ja_20240102_dep_bumps' of github.com:hapifhir/hapi-fhir…
jamesagnew Jan 5, 2024
cb81e27
Version bump
jamesagnew Jan 5, 2024
dad66f7
Merge branch 'master' into ja_20240102_dep_bumps
jamesagnew Jan 5, 2024
d79b6fa
Test fixes
jamesagnew Jan 5, 2024
5777652
Bump maven container
jamesagnew Jan 7, 2024
b80f122
Build fix
jamesagnew Jan 7, 2024
fda79e3
Add license headers
jamesagnew Jan 8, 2024
d7b900f
Merge branch 'master' into ja_20240102_dep_bumps
jamesagnew Jan 9, 2024
296e49a
Merge branch 'ja_20240102_dep_bumps' of github.com:jamesagnew/hapi-fh…
jamesagnew Jan 9, 2024
28e7ad6
Merge branch 'master' into ja_20240102_dep_bumps
jamesagnew Jan 12, 2024
f328f91
Version bump
jamesagnew Jan 12, 2024
7046e0c
License headers
jamesagnew Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test fix
  • Loading branch information
jamesagnew committed Jan 4, 2024
commit ac8f83cf156608656a50c0621a2635aa2c99b164
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import org.apache.commons.lang3.time.DateUtils;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.hibernate.CacheMode;
import org.hibernate.search.engine.search.predicate.dsl.BooleanPredicateClausesStep;
import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep;
Expand Down Expand Up @@ -1293,7 +1294,6 @@ private SearchProperties buildSearchScroll(

// BooleanQuery.setMaxClauseCount(SearchBuilder.getMaximumPageSize());
// TODO GGG HS looks like we can't set max clause count, but it can be set server side.
// BooleanQuery.setMaxClauseCount(10000);
// JM 22-02-15 - Hopefully increasing maxClauseCount should be not needed anymore

SearchQuery<EntityReference> termConceptsQuery = searchSession
Expand Down Expand Up @@ -1323,16 +1323,27 @@ private Optional<PredicateFinalStep> buildExpansionPredicate(
return Optional.empty();
}

if (theCodes.size() < BooleanQuery.getMaxClauseCount()) {
if (theCodes.size() < IndexSearcher.getMaxClauseCount()) {
return Optional.of(thePredicate.simpleQueryString().field("myCode").matching(String.join(" | ", theCodes)));
} else if (IndexSearcher.getMaxClauseCount() < 10000){
/*
* JA: Until Hibernate Search 7 (Lucene 9), it was good enough to
* just split up the clauses into multiple should blocks as shown
* below. But this doesn't work on Lucene 9 any longer. So we are
* back to increasing the max clause count here. This only
* affects Lucene, the fix below does still seem to work
* for ElasticSearch which is what matters more anyhow since
* it's what people should be using for real deployments.
*/
IndexSearcher.setMaxClauseCount(10000);
}

// Number of codes is larger than maxClauseCount, so we split the query in several clauses

// partition codes in lists of BooleanQuery.getMaxClauseCount() size
List<List<String>> listOfLists = ListUtils.partition(theCodes, BooleanQuery.getMaxClauseCount());
List<List<String>> listOfLists = ListUtils.partition(theCodes, IndexSearcher.getMaxClauseCount() - 1);

PredicateFinalStep step = thePredicate.bool(b -> {
PredicateFinalStep step = thePredicate.bool().with(b -> {
b.minimumShouldMatchNumber(1);
for (List<String> codeList : listOfLists) {
b.should(p -> p.simpleQueryString().field("myCode").matching(String.join(" | ", codeList)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import org.apache.commons.collections4.ListUtils;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep;
import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory;
import org.hibernate.search.engine.search.query.SearchQuery;
Expand Down Expand Up @@ -1935,7 +1936,7 @@ public class TestSearchWithManyCodes {

@BeforeEach
void generateLongSearchedCodesList() {
int codesQueriedCount = (int) (BooleanQuery.getMaxClauseCount() * 1.5);
int codesQueriedCount = 1500;
allCodesNotIncludingSearched = generateCodes(codesQueriedCount);

termCsId = createLoincSystemWithSomeCodes();
Expand All @@ -1952,7 +1953,7 @@ public void testShouldNotFindAny() {

@Test
public void testHitsInFirstSublist() {
int insertIndex = BooleanQuery.getMaxClauseCount() / 2;
int insertIndex = IndexSearcher.getMaxClauseCount() / 2;

// insert existing codes into list of codes searched
allCodesNotIncludingSearched.addAll(insertIndex, existingCodes);
Expand Down
Loading