Package io.goobi.viewer.model.search
Class FacetItem
java.lang.Object
io.goobi.viewer.model.search.FacetItem
- All Implemented Interfaces:
IFacetItem
,Serializable
FacetItem class.
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionConstructor for active facets received via the URL.Constructor for active facets received via the URL.FacetItem
(org.apache.solr.client.solrj.response.FacetField.Count count) -
Method Summary
Modifier and TypeMethodDescriptionboolean
static List<IFacetItem>
generateFacetItems
(String field, Map<String, Long> values, boolean sort, boolean reverseOrder, boolean hierarchical) Constructs a list of FilterLink objects for faceting.static List<IFacetItem>
generateFilterLinkList
(List<IFacetItem> existingFacetsItems, String field, FacetSorting.SortingMap<String, Long> values, boolean hierarchical, int groupToLength, Map<String, String> labelMap) Constructs facet items from the list of given field:value combinations.long
getCount()
Getter for the fieldcount
.Link after slash/backslash replacements for partner collection, static drill-down components and topic browsing (HU Berlin).getField()
Getter for the fieldfield
.getFullValue.getLabel()
Getter for the fieldlabel
.getLink()
Getter for the fieldlink
.Returns field:value (with the value escaped for the Solr query).Getter for the fieldtranslatedLabel
.getType()
URL escaped link for using in search drill-downs.getValue()
Getter for the fieldvalue
.Getter for the fieldvalue2
.int
hashCode()
void
increaseCount
(long amount) boolean
boolean
isGroup()
boolean
isHierarchial.setCount
(long count) Setter for the fieldcount
.void
Setter for the fieldfield
.setGroup
(boolean group) Setter for the fieldlabel
.void
Setter for the fieldlink
.void
setTranslatedLabel
(String translatedLabel) Dummy setter to fulfill the interface contract.void
setType
(FacetItem.FacetType type) void
Setter for the fieldvalue
.void
Setter for the fieldvalue2
.toString()
-
Constructor Details
-
FacetItem
Constructor for active facets received via the URL. The Solr query is split into individual field/value.- Parameters:
link
- aString
object.hierarchical
- a boolean.
-
FacetItem
Constructor for active facets received via the URL. The Solr query is split into individual field/value.- Parameters:
link
- aString
object.label
-hierarchical
- a boolean.
-
FacetItem
public FacetItem(org.apache.solr.client.solrj.response.FacetField.Count count) - Parameters:
count
-
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
generateFilterLinkList
public static List<IFacetItem> generateFilterLinkList(List<IFacetItem> existingFacetsItems, String field, FacetSorting.SortingMap<String, Long> values, boolean hierarchical, int groupToLength, Map<String, String> labelMap) Constructs facet items from the list of given field:value combinations. Always sorted by the label translation.- Parameters:
existingFacetsItems
- List of previously generated items (e.g. via other result groups) to combine with new itemsfield
- Facet fieldvalues
- Map containing facet values and their countshierarchical
- true if facet field is hierarchical; false otherwisegroupToLength
- If value is greater than 0, facet values will be grouped together by if they contain equal characters at {0-groupByLength}labelMap
- Optional map for storing alternate labels for later use by the client- Returns:
ArrayList
ofFacetItem
-
generateFacetItems
public static List<IFacetItem> generateFacetItems(String field, Map<String, Long> values, boolean sort, boolean reverseOrder, boolean hierarchical) Constructs a list of FilterLink objects for faceting. Optionally sorted by the raw values. -
getQueryEscapedLink
Returns field:value (with the value escaped for the Solr query).- Specified by:
getQueryEscapedLink
in interfaceIFacetItem
- Returns:
- a
String
object.
-
getEscapedLink
Link after slash/backslash replacements for partner collection, static drill-down components and topic browsing (HU Berlin).- Specified by:
getEscapedLink
in interfaceIFacetItem
- Returns:
- a
String
object.
-
getUrlEscapedLink
URL escaped link for using in search drill-downs.- Specified by:
getUrlEscapedLink
in interfaceIFacetItem
- Returns:
- a
String
object.
-
getType
- Specified by:
getType
in interfaceIFacetItem
- Returns:
- the type
-
setType
- Parameters:
type
- the type to set
-
getField
Getter for the field
field
.- Specified by:
getField
in interfaceIFacetItem
- Returns:
- the field
-
setField
Setter for the field
field
.- Specified by:
setField
in interfaceIFacetItem
- Parameters:
field
- the field to set
-
getFullValue
getFullValue.
- Specified by:
getFullValue
in interfaceIFacetItem
- Returns:
- Range of value - value2; just value if value2 empty
-
getValue
Getter for the field
value
.- Specified by:
getValue
in interfaceIFacetItem
- Returns:
- the value
-
setValue
Setter for the field
value
.- Specified by:
setValue
in interfaceIFacetItem
- Parameters:
value
- the value to set
-
getValue2
Getter for the field
value2
.- Specified by:
getValue2
in interfaceIFacetItem
- Returns:
- the value2
-
setValue2
Setter for the field
value2
.- Specified by:
setValue2
in interfaceIFacetItem
- Parameters:
value2
- the value2 to set
-
getLink
Getter for the field
link
.- Specified by:
getLink
in interfaceIFacetItem
- Returns:
- the link
-
setLink
Setter for the field
link
.- Specified by:
setLink
in interfaceIFacetItem
- Parameters:
link
- the link to set
-
getLabel
Getter for the field
label
.- Specified by:
getLabel
in interfaceIFacetItem
- Returns:
- the label
-
setLabel
Setter for the field
label
.- Specified by:
setLabel
in interfaceIFacetItem
- Parameters:
label
- the label to set- Returns:
- this
-
getTranslatedLabel
Getter for the field
translatedLabel
.- Specified by:
getTranslatedLabel
in interfaceIFacetItem
- Returns:
- the translatedLabel
-
setTranslatedLabel
Dummy setter to fulfill the interface contract.- Specified by:
setTranslatedLabel
in interfaceIFacetItem
- Parameters:
translatedLabel
- the translatedLabel to set
-
getCount
public long getCount()Getter for the field
count
.- Specified by:
getCount
in interfaceIFacetItem
- Returns:
- the count
-
setCount
Setter for the field
count
.- Specified by:
setCount
in interfaceIFacetItem
- Parameters:
count
- the count to set- Returns:
- this
-
increaseCount
public void increaseCount(long amount) -
isGroup
public boolean isGroup()- Specified by:
isGroup
in interfaceIFacetItem
-
setGroup
- Specified by:
setGroup
in interfaceIFacetItem
-
isHierarchial
public boolean isHierarchial()isHierarchial.
- Specified by:
isHierarchial
in interfaceIFacetItem
- Returns:
- the hierarchial
-
isBooleanType
public boolean isBooleanType()- Specified by:
isBooleanType
in interfaceIFacetItem
-
toString
-