diff --git a/src/main/java/org/folio/search/cql/CqlSearchQueryConverter.java b/src/main/java/org/folio/search/cql/CqlSearchQueryConverter.java index 13f90c9e6..d67a3f232 100644 --- a/src/main/java/org/folio/search/cql/CqlSearchQueryConverter.java +++ b/src/main/java/org/folio/search/cql/CqlSearchQueryConverter.java @@ -68,10 +68,19 @@ public SearchSourceBuilder convert(String query, String resource) { * @return search source as {@link SearchSourceBuilder} object with query and sorting conditions */ public SearchSourceBuilder convertForConsortia(String query, String resource) { - return convertForConsortia(query, resource, false); + return convertForConsortia(true, query, resource, false); + } + + public SearchSourceBuilder convertForConsortia(boolean shouldBeShared, String query, String resource) { + return convertForConsortia(shouldBeShared, query, resource, false); } public SearchSourceBuilder convertForConsortia(String query, String resource, boolean consortiumConsolidated) { + return convertForConsortia(true, query, resource, consortiumConsolidated); + } + + public SearchSourceBuilder convertForConsortia(boolean shouldBeShared, String query, String resource, + boolean consortiumConsolidated) { var sourceBuilder = convert(query, resource); if (consortiumConsolidated) { return sourceBuilder; diff --git a/src/main/java/org/folio/search/service/ResourceIdService.java b/src/main/java/org/folio/search/service/ResourceIdService.java index 3a916cdc3..10e134540 100644 --- a/src/main/java/org/folio/search/service/ResourceIdService.java +++ b/src/main/java/org/folio/search/service/ResourceIdService.java @@ -160,9 +160,11 @@ private void streamResourceIds(CqlResourceIdsRequest request, Consumer getAffiliationShouldClauses(String contextTenantId, String centralTenantId, - String resource) { + String resource, boolean shouldBeShared) { var affiliationShouldClauses = new LinkedList(); addTenantIdAffiliationShouldClause(contextTenantId, centralTenantId, affiliationShouldClauses, resource); - addSharedAffiliationShouldClause(affiliationShouldClauses, resource, contextTenantId.equals(centralTenantId)); + addSharedAffiliationShouldClause(affiliationShouldClauses, resource, shouldBeShared); return affiliationShouldClauses; }