Skip to content

Commit

Permalink
Modified IndexServiceBean to use the new feature flag, that has been …
Browse files Browse the repository at this point in the history
…separated from the flag that

enables the search-side optimization;
Fixed the groups sub-query for the guest user. #10554
  • Loading branch information
landreev committed May 28, 2024
1 parent aaec213 commit 9b8c7d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public Future<String> indexDataverse(Dataverse dataverse, boolean processPaths)
solrInputDocument.addField(SearchFields.DATAVERSE_CATEGORY, dataverse.getIndexableCategoryName());
if (dataverse.isReleased()) {
solrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
solrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
}
solrInputDocument.addField(SearchFields.RELEASE_OR_CREATE_DATE, dataverse.getPublicationDate());
Expand Down Expand Up @@ -882,7 +882,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long

if (state.equals(indexableDataset.getDatasetState().PUBLISHED)) {
solrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
solrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
}
// solrInputDocument.addField(SearchFields.RELEASE_OR_CREATE_DATE,
Expand Down Expand Up @@ -1398,7 +1398,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
if (indexableDataset.getDatasetState().equals(indexableDataset.getDatasetState().PUBLISHED)) {
fileSolrDocId = solrDocIdentifierFile + fileEntityId;
datafileSolrInputDocument.addField(SearchFields.PUBLICATION_STATUS, PUBLISHED_STRING);
if (FeatureFlags.AVOID_EXPENSIVE_SOLR_JOIN.enabled()) {
if (FeatureFlags.ADD_PUBLICOBJECT_SOLR_FIELD.enabled()) {
datafileSolrInputDocument.addField(SearchFields.PUBLIC_OBJECT, true);
}
// datafileSolrInputDocument.addField(SearchFields.PERMS, publicGroupString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ
* is indexed on the content document itself, rather than a permission
* document. An additional join will be added only for any extra,
* more restricted groups that the user may be part of.
* Note the experimental nature of this optimization.
* **Note the experimental nature of this optimization**.
*/
StringBuilder sb = new StringBuilder();
StringBuilder sbgroups = new StringBuilder();
Expand All @@ -1074,7 +1074,6 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ

// An AuthenticatedUser should also be able to see all the content
// on which they have direct permissions:
//solrQuery.setParam("q1", SearchFields.DISCOVERABLE_BY + ":" + IndexServiceBean.getGroupPerUserPrefix() + au.getId());
if (au != null) {
groupCounter++;
sbgroups.append(IndexServiceBean.getGroupPerUserPrefix() + au.getId());
Expand All @@ -1087,7 +1086,9 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ
String groupAlias = group.getAlias();
if (groupAlias != null && !groupAlias.isEmpty() && !groupAlias.startsWith("builtIn")) {
groupCounter++;
sbgroups.append(" OR ");
if (groupCounter > 1) {
sbgroups.append(" OR ");
}
sbgroups.append(IndexServiceBean.getGroupPrefix() + groupAlias);
}
}
Expand Down

0 comments on commit 9b8c7d9

Please sign in to comment.