mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
DS-3489: Adding facet values to search result part 2
DS-3489: Added trace logging
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
*/
|
||||
package org.dspace.discovery;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfigurationParameters;
|
||||
import org.dspace.discovery.configuration.DiscoverySearchFilterFacet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -95,7 +98,16 @@ public class DiscoverResult {
|
||||
}
|
||||
|
||||
public List<FacetResult> getFacetResult(String facet){
|
||||
return facetResults.get(facet) == null ? new ArrayList<FacetResult>() : facetResults.get(facet);
|
||||
return ListUtils.emptyIfNull(facetResults.get(facet));
|
||||
}
|
||||
|
||||
public List<FacetResult> getFacetResult(DiscoverySearchFilterFacet field) {
|
||||
List<DiscoverResult.FacetResult> facetValues = getFacetResult(field.getIndexFieldName());
|
||||
//Check if we are dealing with a date, sometimes the facet values arrive as dates !
|
||||
if(facetValues.size() == 0 && field.getType().equals(DiscoveryConfigurationParameters.TYPE_DATE)){
|
||||
facetValues = getFacetResult(field.getIndexFieldName() + ".year");
|
||||
}
|
||||
return ListUtils.emptyIfNull(facetValues);
|
||||
}
|
||||
|
||||
public DSpaceObjectHighlightResult getHighlightedResults(DSpaceObject dso)
|
||||
@@ -114,13 +126,15 @@ public class DiscoverResult {
|
||||
private String authorityKey;
|
||||
private String sortValue;
|
||||
private long count;
|
||||
private String fieldType;
|
||||
|
||||
public FacetResult(String asFilterQuery, String displayedValue, String authorityKey, String sortValue, long count) {
|
||||
public FacetResult(String asFilterQuery, String displayedValue, String authorityKey, String sortValue, long count, String fieldType) {
|
||||
this.asFilterQuery = asFilterQuery;
|
||||
this.displayedValue = displayedValue;
|
||||
this.authorityKey = authorityKey;
|
||||
this.sortValue = sortValue;
|
||||
this.count = count;
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getAsFilterQuery() {
|
||||
@@ -149,6 +163,10 @@ public class DiscoverResult {
|
||||
{
|
||||
return authorityKey != null?"authority":"equals";
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSpellCheckQuery() {
|
||||
|
Reference in New Issue
Block a user