Skip to content

Commit 8f467ce

Browse files
MENDELU/Added a new search filter by accesioned date (#1291)
1 parent 7792639 commit 8f467ce

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

dspace-server-webapp/src/test/data/dspaceFolder/config/spring/api/test-discovery.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
<ref bean="searchFilterAuthor" />
159159
<ref bean="searchFilterSubject" />
160160
<ref bean="searchFilterIssued" />
161+
<ref bean="searchFilterDateAccessioned" />
161162
<ref bean="searchFilterContentInOriginalBundle"/>
162163
<ref bean="searchFilterEntityType"/>
163164
</list>
@@ -171,6 +172,7 @@
171172
<ref bean="searchFilterAuthor" />
172173
<ref bean="searchFilterSubject" />
173174
<ref bean="searchFilterIssued" />
175+
<ref bean="searchFilterDateAccessioned" />
174176
<ref bean="searchFilterContentInOriginalBundle"/>
175177
<ref bean="searchFilterFileNameInOriginalBundle" />
176178
<ref bean="searchFilterFileDescriptionInOriginalBundle" />

dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,6 +3209,7 @@ public void discoverSearchObjectsTestForMinMaxValues() throws Exception {
32093209
FacetEntryMatcher.entityTypeFacet(),
32103210
FacetEntryMatcher.subjectFacet(),
32113211
FacetEntryMatcher.dateIssuedFacetWithMinMax("1990-02-13", "2010-10-17"),
3212+
FacetEntryMatcher.dateAccessionedFacet(),
32123213
FacetEntryMatcher.hasContentInOriginalBundleFacet()
32133214
)))
32143215
//There always needs to be a self link available
@@ -3279,6 +3280,7 @@ public void discoverSearchFacetsTestForMinMaxValues() throws Exception {
32793280
FacetEntryMatcher.entityTypeFacet(),
32803281
FacetEntryMatcher.subjectFacet(),
32813282
FacetEntryMatcher.dateIssuedFacetWithMinMax("1990-02-13", "2010-10-17"),
3283+
FacetEntryMatcher.dateAccessionedFacet(),
32823284
FacetEntryMatcher.hasContentInOriginalBundleFacet()
32833285
)))
32843286
//There always needs to be a self link available

dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ public static Matcher<? super Object> dateIssuedFacet() {
142142
);
143143
}
144144

145+
public static Matcher<? super Object> dateAccessionedFacet() {
146+
return allOf(
147+
hasJsonPath("$.name", is("dateAccessioned")),
148+
hasJsonPath("$.facetType", is("date")),
149+
hasJsonPath("$.facetLimit", any(Integer.class)),
150+
hasJsonPath("$.openByDefault", any(Boolean.class)),
151+
hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateAccessioned")),
152+
hasJsonPath("$._links", matchNextLink("api/discover/facets/dateAccessioned"))
153+
);
154+
}
155+
145156
public static Matcher<? super Object> dateIssuedFacetWithMinMax(String min, String max) {
146157
return allOf(
147158
hasJsonPath("$.name", is("dateIssued")),
@@ -155,6 +166,19 @@ public static Matcher<? super Object> dateIssuedFacetWithMinMax(String min, Stri
155166
);
156167
}
157168

169+
public static Matcher<? super Object> dateAccessionedFacetWithMinMax(String min, String max) {
170+
return allOf(
171+
hasJsonPath("$.name", is("dateAccessioned")),
172+
hasJsonPath("$.facetType", is("date")),
173+
hasJsonPath("$.facetLimit", any(Integer.class)),
174+
hasJsonPath("$.minValue", is(min)),
175+
hasJsonPath("$.maxValue", is(max)),
176+
hasJsonPath("$.openByDefault", any(Boolean.class)),
177+
hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateAccessioned")),
178+
hasJsonPath("$._links", matchNextLink("api/discover/facets/dateAccessioned"))
179+
);
180+
}
181+
158182
public static Matcher<? super Object> hasContentInOriginalBundleFacet() {
159183
return allOf(
160184
hasJsonPath("$.name", is("has_content_in_original_bundle")),

dspace/config/spring/api/discovery.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
<ref bean="searchFilterAuthor" />
197197
<ref bean="searchFilterSubject" />
198198
<ref bean="searchFilterIssued" />
199+
<ref bean="searchFilterDateAccessioned" />
199200
<ref bean="searchFilterContentInOriginalBundle"/>
200201
<!-- <ref bean="searchFilterHasGeospatialMetadata"/> -->
201202
<ref bean="searchFilterEntityType"/>
@@ -211,6 +212,7 @@
211212
<ref bean="searchFilterAuthor" />
212213
<ref bean="searchFilterSubject" />
213214
<ref bean="searchFilterIssued" />
215+
<ref bean="searchFilterDateAccessioned" />
214216
<ref bean="searchFilterContentInOriginalBundle"/>
215217
<ref bean="searchFilterFileNameInOriginalBundle" />
216218
<ref bean="searchFilterFileDescriptionInOriginalBundle" />
@@ -2679,6 +2681,22 @@
26792681
<property name="exposeMinAndMaxValue" value="true"/>
26802682
</bean>
26812683

2684+
<bean id="searchFilterDateAccessioned" class="org.dspace.discovery.configuration.DiscoverySearchFilterFacet">
2685+
<property name="indexFieldName" value="dateAccessioned"/>
2686+
<property name="metadataFields">
2687+
<list>
2688+
<value>dc.date.accessioned</value>
2689+
</list>
2690+
</property>
2691+
<property name="type" value="date"/>
2692+
<property name="facetLimit" value="5"/>
2693+
<property name="sortOrderSidebar" value="COUNT"/>
2694+
<property name="sortOrderFilterPage" value="COUNT"/>
2695+
<property name="isOpenByDefault" value="false"/>
2696+
<property name="pageSize" value="10"/>
2697+
<property name="exposeMinAndMaxValue" value="true"/>
2698+
</bean>
2699+
26822700
<!-- Spatial facet -->
26832701
<bean id="searchFilterGeospatialPoint" class="org.dspace.discovery.configuration.DiscoverySearchFilterFacet">
26842702
<property name="indexFieldName" value="point"/>

0 commit comments

Comments
 (0)