Skip to content

Commit

Permalink
Merge pull request #10408 from IQSS/expose-and-sort-publish-status-facet
Browse files Browse the repository at this point in the history
Fix PUBLICATION_STATUS facet order and visibility
  • Loading branch information
pdurbin authored Mar 22, 2024
2 parents 4c33a5c + 4093e18 commit 30666f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In version 6.1, the publication status facet location was unintentionally moved to the bottom. In this version, we have restored the original order.
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,11 @@ public SolrQueryResponse search(
SolrQuery solrQuery = new SolrQuery();
query = SearchUtil.sanitizeQuery(query);
solrQuery.setQuery(query);
// SortClause foo = new SortClause("name", SolrQuery.ORDER.desc);
// if (query.equals("*") || query.equals("*:*")) {
// solrQuery.setSort(new SortClause(SearchFields.NAME_SORT, SolrQuery.ORDER.asc));
if (sortField != null) {
// is it ok not to specify any sort? - there are cases where we
// don't care, and it must cost some extra cycles -- L.A.
solrQuery.setSort(new SortClause(sortField, sortOrder));
}
// } else {
// solrQuery.setSort(sortClause);
// }
// solrQuery.setSort(sortClause);


solrQuery.setParam("fl", "*,score");
solrQuery.setParam("qt", "/select");
Expand All @@ -224,13 +216,23 @@ public SolrQueryResponse search(
List<DataverseMetadataBlockFacet> metadataBlockFacets = new LinkedList<>();

if (addFacets) {



// -----------------------------------
// Facets to Retrieve
// -----------------------------------
solrQuery.addFacetField(SearchFields.METADATA_TYPES);
solrQuery.addFacetField(SearchFields.DATAVERSE_CATEGORY);
solrQuery.addFacetField(SearchFields.METADATA_SOURCE);
solrQuery.addFacetField(SearchFields.PUBLICATION_YEAR);
/*
* We talked about this in slack on 2021-09-14, Users can see objects on draft/unpublished
* if the owner gives permissions to all users so it makes sense to expose this facet
* to all users. The request of this change started because the order of the facets were
* changed with the PR #9635 and this was unintended.
*/
solrQuery.addFacetField(SearchFields.PUBLICATION_STATUS);
solrQuery.addFacetField(SearchFields.DATASET_LICENSE);
/**
* @todo when a new method on datasetFieldService is available
Expand All @@ -251,6 +253,7 @@ public SolrQueryResponse search(
DatasetFieldType datasetField = dataverseFacet.getDatasetFieldType();
solrQuery.addFacetField(datasetField.getSolrField().getNameFacetable());
}

// Get all metadata block facets configured to be displayed
metadataBlockFacets.addAll(dataverse.getMetadataBlockFacets());
}
Expand Down Expand Up @@ -1029,11 +1032,11 @@ private String getPermissionFilterQuery(DataverseRequest dataverseRequest, SolrQ

AuthenticatedUser au = (AuthenticatedUser) user;

if (addFacets) {
// Logged in user, has publication status facet
//
solrQuery.addFacetField(SearchFields.PUBLICATION_STATUS);
}
// if (addFacets) {
// // Logged in user, has publication status facet
// //
// solrQuery.addFacetField(SearchFields.PUBLICATION_STATUS);
// }

// ----------------------------------------------------
// (3) Is this a Super User?
Expand Down

0 comments on commit 30666f9

Please sign in to comment.