Class FacetItem

java.lang.Object
io.goobi.viewer.model.search.FacetItem
All Implemented Interfaces:
IFacetItem, Serializable

public class FacetItem extends Object implements Serializable, IFacetItem

FacetItem class.

See Also:
  • Constructor Details

    • FacetItem

      public FacetItem(String link, boolean hierarchical)
      Constructor for active facets received via the URL. The Solr query is split into individual field/value.
      Parameters:
      link - a String object.
      hierarchical - a boolean.
    • FacetItem

      public FacetItem(String link, String label, boolean hierarchical)
      Constructor for active facets received via the URL. The Solr query is split into individual field/value.
      Parameters:
      link - a String object.
      label -
      hierarchical - a boolean.
    • FacetItem

      public FacetItem(org.apache.solr.client.solrj.response.FacetField.Count count)
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • generateFilterLinkList

      public static List<IFacetItem> generateFilterLinkList(List<IFacetItem> existingFacetsItems, String field, Map<String,Long> values, boolean hierarchical, int groupToLength, Locale locale, 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 items
      field - Facet field
      values - Map containing facet values and their counts
      hierarchical - true if facet field is hierarchical; false otherwise
      groupToLength - If value is greater than 0, facet values will be grouped together by if they contain equal characters at {0-groupByLength}
      locale - Optional locale for translation
      labelMap - Optional map for storing alternate labels for later use by the client
      Returns:
      ArrayList of FacetItem
    • 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.
      Parameters:
      field - a String object.
      values - a Map object.
      sort - a boolean.
      reverseOrder - a boolean.
      hierarchical - a boolean.
      Returns:
      a List object.
    • getQueryEscapedLink

      public String getQueryEscapedLink()
      Returns field:value (with the value escaped for the Solr query).
      Specified by:
      getQueryEscapedLink in interface IFacetItem
      Returns:
      a String object.
    • getEscapedLink

      public String getEscapedLink()
      Link after slash/backslash replacements for partner collection, static drill-down components and topic browsing (HU Berlin).
      Specified by:
      getEscapedLink in interface IFacetItem
      Returns:
      a String object.
    • getUrlEscapedLink

      public String getUrlEscapedLink()
      URL escaped link for using in search drill-downs.
      Specified by:
      getUrlEscapedLink in interface IFacetItem
      Returns:
      a String object.
    • getField

      public String getField()

      Getter for the field field.

      Specified by:
      getField in interface IFacetItem
      Returns:
      the field
    • setField

      public void setField(String field)

      Setter for the field field.

      Specified by:
      setField in interface IFacetItem
      Parameters:
      field - the field to set
    • getFullValue

      public String getFullValue()

      getFullValue.

      Specified by:
      getFullValue in interface IFacetItem
      Returns:
      Range of value - value2; just value if value2 empty
    • getValue

      public String getValue()

      Getter for the field value.

      Specified by:
      getValue in interface IFacetItem
      Returns:
      the value
    • setValue

      public void setValue(String value)

      Setter for the field value.

      Specified by:
      setValue in interface IFacetItem
      Parameters:
      value - the value to set
    • getValue2

      public String getValue2()

      Getter for the field value2.

      Specified by:
      getValue2 in interface IFacetItem
      Returns:
      the value2
    • setValue2

      public void setValue2(String value2)

      Setter for the field value2.

      Specified by:
      setValue2 in interface IFacetItem
      Parameters:
      value2 - the value2 to set
    • getLink

      public String getLink()

      Getter for the field link.

      Specified by:
      getLink in interface IFacetItem
      Returns:
      the link
    • setLink

      public void setLink(String link)

      Setter for the field link.

      Specified by:
      setLink in interface IFacetItem
      Parameters:
      link - the link to set
    • getLabel

      public String getLabel()

      Getter for the field label.

      Specified by:
      getLabel in interface IFacetItem
      Returns:
      the label
    • setLabel

      public FacetItem setLabel(String label)

      Setter for the field label.

      Specified by:
      setLabel in interface IFacetItem
      Parameters:
      label - the label to set
      Returns:
      this
    • getTranslatedLabel

      public String getTranslatedLabel()

      Getter for the field translatedLabel.

      Specified by:
      getTranslatedLabel in interface IFacetItem
      Returns:
      the translatedLabel
    • setTranslatedLabel

      public void setTranslatedLabel(String translatedLabel)

      Setter for the field translatedLabel.

      Specified by:
      setTranslatedLabel in interface IFacetItem
      Parameters:
      translatedLabel - the translatedLabel to set
    • getCount

      public long getCount()

      Getter for the field count.

      Specified by:
      getCount in interface IFacetItem
      Returns:
      the count
    • setCount

      public FacetItem setCount(long count)

      Setter for the field count.

      Specified by:
      setCount in interface IFacetItem
      Parameters:
      count - the count to set
      Returns:
      this
    • increaseCount

      public void increaseCount(long amount)
    • isGroup

      public boolean isGroup()
      Specified by:
      isGroup in interface IFacetItem
    • setGroup

      public IFacetItem setGroup(boolean group)
      Specified by:
      setGroup in interface IFacetItem
    • isHierarchial

      public boolean isHierarchial()

      isHierarchial.

      Specified by:
      isHierarchial in interface IFacetItem
      Returns:
      the hierarchial
    • toString

      public String toString()
      Overrides:
      toString in class Object