Skip to content

Commit

Permalink
search filterfacet isOpenByDefault as facetentry property
Browse files Browse the repository at this point in the history
  • Loading branch information
floriangantner committed Dec 25, 2024
1 parent f6ce766 commit 9e04b9f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private void addSidebarFacets(FacetConfigurationRest facetConfigurationRest,
SearchFacetEntryRest facetEntry = new SearchFacetEntryRest(discoverySearchFilterFacet.getIndexFieldName());
facetEntry.setFacetType(discoverySearchFilterFacet.getType());
facetEntry.setFacetLimit(discoverySearchFilterFacet.getFacetLimit());
facetEntry.setOpenByDefault(discoverySearchFilterFacet.isOpenByDefault());

facetConfigurationRest.addSidebarFacet(facetEntry);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private SearchFacetEntryRest convertFacetEntry(final String facetName, final Dis
}

facetEntryRest.setFacetLimit(field.getFacetLimit());
facetEntryRest.setOpenByDefault(field.isOpenByDefault());

//We requested one extra facet value. Check if that value is present to indicate that there are more results
facetEntryRest.setHasMore(facetResults.size() > page.getPageSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.dspace.app.rest.DiscoveryRestController;
import org.dspace.discovery.configuration.DiscoverySearchFilter;
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;

/**
Expand All @@ -31,6 +32,9 @@ public class SearchFacetEntryRest extends RestAddressableModel {
private Boolean hasMore = null;
private int facetLimit;

@JsonIgnore
private Boolean isOpenByDefault;

@JsonIgnore
private boolean exposeMinMax = false;

Expand Down Expand Up @@ -107,6 +111,16 @@ public void setFacetLimit(final int facetLimit) {
this.facetLimit = facetLimit;
}

public void setOpenByDefault(boolean isOpenByDefault) {
this.isOpenByDefault = Boolean.valueOf(isOpenByDefault);
}
/**
* See documentation at {@link DiscoverySearchFilter#isOpenByDefault()}
*/
public Boolean isOpenByDefault() {
return this.isOpenByDefault;
}

/**
* See documentation at {@link DiscoverySearchFilterFacet#exposeMinAndMaxValue()}
*/
Expand Down

0 comments on commit 9e04b9f

Please sign in to comment.