Skip to content

Commit

Permalink
search filterfacet isOpenByDefault as facetentry property to FacetsCo…
Browse files Browse the repository at this point in the history
…nverter

DSpace#9404
  • Loading branch information
floriangantner committed Dec 27, 2024
1 parent 9e04b9f commit ee5d470
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void addFacetValues(Context context, final DiscoverResult searchResult, f
if (field.exposeMinAndMaxValue()) {
handleExposeMinMaxValues(context, field, facetEntry);
}
facetEntry.setOpenByDefault(field.isOpenByDefault());
facetEntry.setExposeMinMax(field.exposeMinAndMaxValue());
facetEntry.setFacetType(field.getType());
for (DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static Matcher<? super Object> authorFacet(boolean hasNext) {
hasJsonPath("$.name", is("author")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/author")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/author"))
);
Expand All @@ -40,6 +41,7 @@ public static Matcher<? super Object> authorFacetWithMinMax(boolean hasNext, Str
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/author")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/author"))
);
Expand All @@ -50,6 +52,7 @@ public static Matcher<? super Object> subjectFacet(boolean hasNext) {
hasJsonPath("$.name", is("subject")),
hasJsonPath("$.facetType", is("hierarchical")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/subject")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/subject"))

Expand All @@ -61,6 +64,7 @@ public static Matcher<? super Object> submitterFacet(boolean hasNext) {
hasJsonPath("$.name", is("submitter")),
hasJsonPath("$.facetType", is("authority")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/submitter")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/submitter"))

Expand All @@ -72,6 +76,7 @@ public static Matcher<? super Object> supervisedByFacet(boolean hasNext) {
hasJsonPath("$.name", is("supervisedBy")),
hasJsonPath("$.facetType", is("authority")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/supervisedBy")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/supervisedBy"))

Expand All @@ -83,6 +88,7 @@ public static Matcher<? super Object> dateIssuedFacet(boolean hasNext) {
hasJsonPath("$.name", is("dateIssued")),
hasJsonPath("$.facetType", is("date")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/dateIssued")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/dateIssued"))
);
Expand All @@ -95,6 +101,7 @@ public static Matcher<? super Object> dateIssuedFacetWithMinMax(boolean hasNext,
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/dateIssued")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/dateIssued"))
);
Expand All @@ -105,6 +112,7 @@ public static Matcher<? super Object> hasContentInOriginalBundleFacet(boolean ha
hasJsonPath("$.name", is("has_content_in_original_bundle")),
hasJsonPath("$.facetType", is("standard")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/has_content_in_original_bundle")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/has_content_in_original_bundle"))
);
Expand All @@ -115,6 +123,7 @@ public static Matcher<? super Object> matchFacet(boolean hasNext, String name, S
hasJsonPath("$.name", is(name)),
hasJsonPath("$.facetType", is(facetType)),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/" + name)),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/" + name))
);
Expand All @@ -133,6 +142,7 @@ public static Matcher<? super Object> typeFacet(boolean b) {
hasJsonPath("$.name", is("itemtype")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/itemtype")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/itemtype"))
);
Expand All @@ -151,6 +161,7 @@ public static Matcher<? super Object> resourceTypeFacet(boolean b) {
hasJsonPath("$.name", is("namedresourcetype")),
hasJsonPath("$.facetType", is("authority")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/namedresourcetype")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/namedresourcetype"))
);
Expand All @@ -165,6 +176,7 @@ public static Matcher<? super Object> entityTypeFacet(boolean hasNext) {
return allOf(
hasJsonPath("$.name", is("entityType")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/entityType")),
hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/entityType"))
);
Expand All @@ -175,6 +187,7 @@ public static Matcher<? super Object> relatedItemFacet(boolean b) {
hasJsonPath("$.name", is("relateditem")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/relateditem")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/relateditem"))
);
Expand All @@ -185,6 +198,7 @@ public static Matcher<? super Object> originFacet(boolean b) {
hasJsonPath("$.name", is("origin")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/origin")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/origin"))
);
Expand All @@ -195,6 +209,7 @@ public static Matcher<? super Object> targetFacet(boolean b) {
hasJsonPath("$.name", is("target")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/target")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/target"))
);
Expand All @@ -205,6 +220,7 @@ public static Matcher<? super Object> queueStatusFacet(boolean b) {
hasJsonPath("$.name", is("queue_status")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/queue_status")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/queue_status"))
);
Expand All @@ -215,6 +231,7 @@ public static Matcher<? super Object> activityStreamTypeFacet(boolean b) {
hasJsonPath("$.name", is("activity_stream_type")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/activity_stream_type")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/activity_stream_type"))
);
Expand All @@ -225,6 +242,7 @@ public static Matcher<? super Object> coarNotifyTypeFacet(boolean b) {
hasJsonPath("$.name", is("coar_notify_type")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/coar_notify_type")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/coar_notify_type"))
);
Expand All @@ -235,6 +253,7 @@ public static Matcher<? super Object> notificationTypeFacet(boolean b) {
hasJsonPath("$.name", is("notification_type")),
hasJsonPath("$.facetType", is("text")),
hasJsonPath("$.facetLimit", any(Integer.class)),
hasJsonPath("$.openByDefault", any(Boolean.class)),
hasJsonPath("$._links.self.href", containsString("api/discover/facets/notification_type")),
hasJsonPath("$._links", matchNextLink(b, "api/discover/facets/notification_type"))
);
Expand Down

0 comments on commit ee5d470

Please sign in to comment.