diff --git a/src/main/java/org/folio/search/service/ResourceIdService.java b/src/main/java/org/folio/search/service/ResourceIdService.java index 051c84910..0da6a4ef9 100644 --- a/src/main/java/org/folio/search/service/ResourceIdService.java +++ b/src/main/java/org/folio/search/service/ResourceIdService.java @@ -174,7 +174,7 @@ private void streamResourceIds(CqlResourceIdsRequest request, Consumer idsStreamProcessor) { try (var json = objectMapper.createGenerator(outputStream)) { diff --git a/src/main/java/org/folio/search/service/consortium/ConsortiumSearchHelper.java b/src/main/java/org/folio/search/service/consortium/ConsortiumSearchHelper.java index 843ef1bf0..d24aa1c56 100644 --- a/src/main/java/org/folio/search/service/consortium/ConsortiumSearchHelper.java +++ b/src/main/java/org/folio/search/service/consortium/ConsortiumSearchHelper.java @@ -43,6 +43,9 @@ public class ConsortiumSearchHelper { public QueryBuilder filterQueryForActiveAffiliation(QueryBuilder query, String resource) { var contextTenantId = folioExecutionContext.getTenantId(); var centralTenantId = consortiumTenantService.getCentralTenant(contextTenantId); + logger.info("[SLY] *** CONTEXT: {}, CENTRAL: {}, RESOURCE: {}", contextTenantId, centralTenantId, resource); + logger.info("[SLY] *** query: {}", query.toString()); + if (centralTenantId.isEmpty()) { return query; } @@ -163,7 +166,7 @@ private LinkedList getAffiliationShouldClauses(String contextTenan var affiliationShouldClauses = new LinkedList(); addTenantIdAffiliationShouldClause(contextTenantId, centralTenantId, affiliationShouldClauses, resource); - addSharedAffiliationShouldClause(affiliationShouldClauses, resource); + addSharedAffiliationShouldClause(affiliationShouldClauses, resource, contextTenantId.equals(centralTenantId)); return affiliationShouldClauses; } @@ -175,8 +178,8 @@ private void addTenantIdAffiliationShouldClause(String contextTenantId, String c } private void addSharedAffiliationShouldClause(LinkedList affiliationShouldClauses, - String resource) { - affiliationShouldClauses.add(termQuery(getFieldForResource(SHARED_FIELD_NAME, resource), true)); + String resource, boolean isShared) { + affiliationShouldClauses.add(termQuery(getFieldForResource(SHARED_FIELD_NAME, resource), isShared)); } private void removeOriginalSharedFilterFromQuery(QueryBuilder queryBuilder) {