From 1d2a3f724fc5bc453a8ae2f2c114f35b7fb0328b Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Fri, 20 Mar 2026 14:10:00 +0100 Subject: [PATCH] Added a new search filter by accesioned date --- .../config/spring/api/test-discovery.xml | 2 ++ .../app/rest/DiscoveryRestControllerIT.java | 2 ++ .../app/rest/matcher/FacetEntryMatcher.java | 24 +++++++++++++++++++ dspace/config/spring/api/discovery.xml | 18 ++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/dspace-server-webapp/src/test/data/dspaceFolder/config/spring/api/test-discovery.xml b/dspace-server-webapp/src/test/data/dspaceFolder/config/spring/api/test-discovery.xml index c78ebe3e4adf..95c02875cd2e 100644 --- a/dspace-server-webapp/src/test/data/dspaceFolder/config/spring/api/test-discovery.xml +++ b/dspace-server-webapp/src/test/data/dspaceFolder/config/spring/api/test-discovery.xml @@ -158,6 +158,7 @@ + @@ -171,6 +172,7 @@ + diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java index 89f55de2de82..759d8afd9cef 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java @@ -3209,6 +3209,7 @@ public void discoverSearchObjectsTestForMinMaxValues() throws Exception { FacetEntryMatcher.entityTypeFacet(), FacetEntryMatcher.subjectFacet(), FacetEntryMatcher.dateIssuedFacetWithMinMax("1990-02-13", "2010-10-17"), + FacetEntryMatcher.dateAccessionedFacet(), FacetEntryMatcher.hasContentInOriginalBundleFacet() ))) //There always needs to be a self link available @@ -3279,6 +3280,7 @@ public void discoverSearchFacetsTestForMinMaxValues() throws Exception { FacetEntryMatcher.entityTypeFacet(), FacetEntryMatcher.subjectFacet(), FacetEntryMatcher.dateIssuedFacetWithMinMax("1990-02-13", "2010-10-17"), + FacetEntryMatcher.dateAccessionedFacet(), FacetEntryMatcher.hasContentInOriginalBundleFacet() ))) //There always needs to be a self link available diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java index 64b7e0b1e5a0..982e4279188a 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java @@ -142,6 +142,17 @@ public static Matcher dateIssuedFacet() { ); } + public static Matcher dateAccessionedFacet() { + return allOf( + hasJsonPath("$.name", is("dateAccessioned")), + hasJsonPath("$.facetType", is("date")), + hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.openByDefault", any(Boolean.class)), + hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateAccessioned")), + hasJsonPath("$._links", matchNextLink("api/discover/facets/dateAccessioned")) + ); + } + public static Matcher dateIssuedFacetWithMinMax(String min, String max) { return allOf( hasJsonPath("$.name", is("dateIssued")), @@ -155,6 +166,19 @@ public static Matcher dateIssuedFacetWithMinMax(String min, Stri ); } + public static Matcher dateAccessionedFacetWithMinMax(String min, String max) { + return allOf( + hasJsonPath("$.name", is("dateAccessioned")), + hasJsonPath("$.facetType", is("date")), + hasJsonPath("$.facetLimit", any(Integer.class)), + hasJsonPath("$.minValue", is(min)), + hasJsonPath("$.maxValue", is(max)), + hasJsonPath("$.openByDefault", any(Boolean.class)), + hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateAccessioned")), + hasJsonPath("$._links", matchNextLink("api/discover/facets/dateAccessioned")) + ); + } + public static Matcher hasContentInOriginalBundleFacet() { return allOf( hasJsonPath("$.name", is("has_content_in_original_bundle")), diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index 3049a4136392..48a4ea0f1c34 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -196,6 +196,7 @@ + @@ -211,6 +212,7 @@ + @@ -2679,6 +2681,22 @@ + + + + + dc.date.accessioned + + + + + + + + + + +