From 1b826fb4232707d044f5353ce0ac225eaa12f667 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Thu, 21 Mar 2024 15:23:19 -0400 Subject: [PATCH 1/4] Fix the issue with the order of the facets and also expose this facet to all users --- .../dataverse/search/SearchServiceBean.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java index 0b93c617c1a..079e3ec35c6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java @@ -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"); @@ -222,6 +214,14 @@ public SolrQueryResponse search( } List metadataBlockFacets = new LinkedList<>(); + + /* + * 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); if (addFacets) { // ----------------------------------- @@ -251,6 +251,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()); } @@ -1029,11 +1030,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? From d3ef749036e782d9de137522e255e94e565491bc Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Thu, 21 Mar 2024 15:42:14 -0400 Subject: [PATCH 2/4] Add release notes --- doc/release-notes/10338-expose-and-sort-publish-status-facet.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/release-notes/10338-expose-and-sort-publish-status-facet.md diff --git a/doc/release-notes/10338-expose-and-sort-publish-status-facet.md b/doc/release-notes/10338-expose-and-sort-publish-status-facet.md new file mode 100644 index 00000000000..a14ea62da67 --- /dev/null +++ b/doc/release-notes/10338-expose-and-sort-publish-status-facet.md @@ -0,0 +1 @@ +In version 6.1, the publication status facet location was unintentionally moved to the bottom, and it also prevented it from being visible to guest users. In version 6.2, we have restored its visibility to all users and moved it back to the top of the list. \ No newline at end of file From 77e4eac90fc9f3bd7125209df2a99577606789bf Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Thu, 21 Mar 2024 16:01:11 -0400 Subject: [PATCH 3/4] Change should still be inside the logic for the facets --- .../iq/dataverse/search/SearchServiceBean.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java index 079e3ec35c6..4e345a1e036 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java @@ -214,16 +214,17 @@ public SolrQueryResponse search( } List metadataBlockFacets = new LinkedList<>(); - - /* - * 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); if (addFacets) { + + /* + * 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); + // ----------------------------------- // Facets to Retrieve // ----------------------------------- From 4093e18e19a6d872bcd4b24612748193f3080a1e Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Thu, 21 Mar 2024 17:04:33 -0400 Subject: [PATCH 4/4] Fix order and patch notes --- .../10338-expose-and-sort-publish-status-facet.md | 2 +- .../iq/dataverse/search/SearchServiceBean.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/release-notes/10338-expose-and-sort-publish-status-facet.md b/doc/release-notes/10338-expose-and-sort-publish-status-facet.md index a14ea62da67..b2362ddb2c5 100644 --- a/doc/release-notes/10338-expose-and-sort-publish-status-facet.md +++ b/doc/release-notes/10338-expose-and-sort-publish-status-facet.md @@ -1 +1 @@ -In version 6.1, the publication status facet location was unintentionally moved to the bottom, and it also prevented it from being visible to guest users. In version 6.2, we have restored its visibility to all users and moved it back to the top of the list. \ No newline at end of file +In version 6.1, the publication status facet location was unintentionally moved to the bottom. In this version, we have restored the original order. diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java index 4e345a1e036..c6f08151050 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java @@ -217,13 +217,7 @@ public SolrQueryResponse search( if (addFacets) { - /* - * 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); + // ----------------------------------- // Facets to Retrieve @@ -232,6 +226,13 @@ public SolrQueryResponse search( 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