Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PUBLICATION_STATUS facet order and visibility #10408

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading