Skip to content

Commit 9b8c7d9

Browse files
committed
Modified IndexServiceBean to use the new feature flag, that has been separated from the flag that
enables the search-side optimization; Fixed the groups sub-query for the guest user. #10554
1 parent aaec213 commit 9b8c7d9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public Future<String> indexDataverse(Dataverse dataverse, boolean processPaths)
215215
solrInputDocument.addField(SearchFields.DATAVERSE_CATEGORY, dataverse.getIndexableCategoryName());
216216
if (dataverse.isReleased()) {
217217
solrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
218-
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
218+
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
219219
solrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
220220
}
221221
solrInputDocument.addField(SearchFields.RELEASE_OR_CREATE_DATE, dataverse.getPublicationDate());
@@ -882,7 +882,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
882882

883883
if (state.equals(indexableDataset.getDatasetState().PUBLISHED)) {
884884
solrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
885-
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
885+
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
886886
solrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
887887
}
888888
// solrInputDocument.addField(SearchFields.RELEASE_OR_CREATE_DATE,
@@ -1398,7 +1398,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
13981398
if (indexableDataset.getDatasetState().equals(indexableDataset.getDatasetState().PUBLISHED)) {
13991399
fileSolrDocId = solrDocIdentifierFile + fileEntityId;
14001400
datafileSolrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
1401-
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
1401+
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
14021402
datafileSolrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
14031403
}
14041404
// datafileSolrInputDocument.addField(SearchFields.PERMS, publicGroupString);

src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ
10571057
* is indexed on the content document itself, rather than a permission
10581058
* document. An additional join will be added only for any extra,
10591059
* more restricted groups that the user may be part of.
1060-
* Note the experimental nature of this optimization.
1060+
* **Note the experimental nature of this optimization**.
10611061
*/
10621062
StringBuilder sb = new StringBuilder();
10631063
StringBuilder sbgroups = new StringBuilder();
@@ -1074,7 +1074,6 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ
10741074

10751075
// An AuthenticatedUser should also be able to see all the content
10761076
// on which they have direct permissions:
1077-
//solrQuery.setParam("q1", SearchFields.DISCOVERABLE_BY + ":" + IndexServiceBean.getGroupPerUserPrefix() + au.getId());
10781077
if (au != null) {
10791078
groupCounter++;
10801079
sbgroups.append(IndexServiceBean.getGroupPerUserPrefix() + au.getId());
@@ -1087,7 +1086,9 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ
10871086
String groupAlias = group.getAlias();
10881087
if (groupAlias != null && !groupAlias.isEmpty() && !groupAlias.startsWith("builtIn")) {
10891088
groupCounter++;
1090-
sbgroups.append(" OR ");
1089+
if (groupCounter > 1) {
1090+
sbgroups.append(" OR ");
1091+
}
10911092
sbgroups.append(IndexServiceBean.getGroupPrefix() + groupAlias);
10921093
}
10931094
}

0 commit comments

Comments
 (0)