Skip to content

Commit

Permalink
Merge pull request IQSS#11134 from GlobalDataverseCommunityConsortium…
Browse files Browse the repository at this point in the history
…/IQSS/11133-search-fix0with-multiple-groups

IQSS/11133-search-fix
  • Loading branch information
ofahimIQSS authored Jan 15, 2025
2 parents 6f964a3 + 7c2e3be commit d70de2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doc/release-notes/11133-search-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Search fix when using AVOID_EXPENSIVE_SOLR_JOIN=true

Dataverse v6.5 introduced a bug which causes search to fail for non-superusers in multiple groups when the AVOID_EXPENSIVE_SOLR_JOIN feature flag is set to true. This releases fixes the bug.
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,13 @@ public SolrQueryResponse search(
// -----------------------------------
// PERMISSION FILTER QUERY
// -----------------------------------
String permissionFilterQuery = this.getPermissionFilterQuery(dataverseRequest, solrQuery, onlyDatatRelatedToMe, addFacets);
if (!StringUtils.isBlank(permissionFilterQuery)) {
solrQuery.addFilterQuery(permissionFilterQuery);
String permissionFilterQuery = getPermissionFilterQuery(dataverseRequest, solrQuery, onlyDatatRelatedToMe, addFacets);
if (!permissionFilterQuery.isEmpty()) {
String[] filterParts = permissionFilterQuery.split("&q1=");
solrQuery.addFilterQuery(filterParts[0]);
if(filterParts.length > 1 ) {
solrQuery.add("q1", filterParts[1]);
}
}

/**
Expand Down Expand Up @@ -1099,9 +1103,9 @@ private String buildPermissionFilterQuery(boolean avoidJoin, String permissionFi
String query = (avoidJoin&& !isAllGroups(permissionFilterGroups)) ? SearchFields.PUBLIC_OBJECT + ":" + true : "";
if (permissionFilterGroups != null && !isAllGroups(permissionFilterGroups)) {
if (!query.isEmpty()) {
query = "(" + query + " OR " + "{!join from=" + SearchFields.DEFINITION_POINT + " to=id}" + SearchFields.DISCOVERABLE_BY + ":" + permissionFilterGroups + ")";
query = "(" + query + " OR " + "{!join from=" + SearchFields.DEFINITION_POINT + " to=id v=$q1})&q1=" + SearchFields.DISCOVERABLE_BY + ":" + permissionFilterGroups;
} else {
query = "{!join from=" + SearchFields.DEFINITION_POINT + " to=id}" + SearchFields.DISCOVERABLE_BY + ":" + permissionFilterGroups;
query = "{!join from=" + SearchFields.DEFINITION_POINT + " to=id v=$q1}&q1=" + SearchFields.DISCOVERABLE_BY + ":" + permissionFilterGroups;
}
}
return query;
Expand Down

0 comments on commit d70de2c

Please sign in to comment.