Package io.goobi.viewer.model.search
Class SearchFacets
java.lang.Object
io.goobi.viewer.model.search.SearchFacets
- All Implemented Interfaces:
Serializable
Current faceting settings for a search.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
collapseFacet
(String field) Sets the expanded flag tofalse
for the given facet field.void
expandFacet
(String field) Sets the expanded flag totrue
for the given facet field.generateFacetFilterQueries
(boolean includeRangeFacets) Generates a list containing filter queries for the selected regular and hierarchical facets.getAbsoluteMaxRangeValue
(String field) Returns the maximum value for the given field available in the search index.getAbsoluteMinRangeValue
(String field) Returns the minimum value for the given field available in the search index.Getter for the fieldactiveFacets
.getActiveFacetsForField
(String field) Returns a list of FacetItem objects inactiveFacets
where the field name matches the given field name.int
int
getActiveFacetsSizeForField.Returns a URL encoded SSV string of facet fields and values from the elements inactiveFacets
(hyphen if empty).Returns a URL encoded value returned by generateFacetPrefix() for regular facets.getActiveFacetStringPrefix
(String omitField) getActiveFacetStringPrefix
(List<String> omitFields, boolean urlEncode) Returns the value returned by generateFacetPrefix() for regular facets.Returns configured facet fields of regular and hierarchical type only.Getter for the fieldavailableFacets
.getAvailableFacetsForField
(String field, boolean excludeSelected) int
Returns the size of the full element list of the facet for the given field.getConfiguredSubelementFacetFields.getCurrentMaxRangeValue
(String field) getCurrentMaxRangeValue.getCurrentMinRangeValue
(String field) getCurrentMinRangeValue.getFacetDescription
(String field) getFacetDescription.getFacetValue
(String field) getFacetValue.getFirstHierarchicalFacetDescription.getFirstHierarchicalFacetValue.getHierarchicalFacets
(String facetString, List<String> facetFields) getHierarchicalFacets.Returns a collapsed sublist of the available facet elements for the given field.int
getRangeFacetMaxValue
(String field) int
getRangeFacetMinValue
(String field) getRangeFacetStyle
(String field) Getter for the fieldtempValue
.getValueRange
(String field) Returns a sorted list of all available values for the given field among available facet values.getValueRangeAsJsonMap
(String field) boolean
boolean
isDisplayFacetCollapseLink
(String field) isDisplayFacetCollapseLink.boolean
isDisplayFacetExpandLink
(String field) Returns true if the "(more)" link is to be displayed for a facet box.boolean
isFacetCollapsed
(String field) isFacetCollapsed.boolean
isFacetCurrentlyUsed
(IFacetItem facet) Checks whether the given facet is currently in use.boolean
isFacetExpanded
(String field) Returns true if the value for the given field type infacetsExpanded
has been previously set to true.boolean
isFacetListSizeSufficient
(String field) isFacetListSizeSufficient.boolean
boolean
boolean
isHasWrongLanguageCode
(String field, String language) Returns true if the givenfield
is language-specific to a different language than the givenlanguage
.boolean
isRangeFacetActive
(String field) boolean
Checks whether there are still selectable values across all available facet fields.removeFacetAction
(String facetQuery, String ret) removeFacetAction.void
resetCurrentFacets.void
resetActiveFacetString.void
resetAvailableFacets.void
resetSliderRange.void
setActiveFacetString
(String activeFacetString) Receives an SSV string of facet fields and values (FIELD1:value1;FIELD2:value2;FIELD3:value3) and generates new Elements for currentFacets.void
setGeoFacetFeature
(String feature) Sets the feature of the geoFacettingfield to to given feature.void
setTempValue
(String tempValue) Setter for the fieldtempValue
.splitHierarchicalFacet
(String facet) splitHierarchicalFacet.updateFacetItem
(String field, boolean hierarchical) Updates existing facet item for the given field with a new value.
-
Constructor Details
-
SearchFacets
public SearchFacets()
-
-
Method Details
-
resetAvailableFacets
public void resetAvailableFacets()resetAvailableFacets.
-
resetActiveFacets
public void resetActiveFacets()resetCurrentFacets.
-
resetSliderRange
public void resetSliderRange()resetSliderRange.
-
generateFacetFilterQueries
Generates a list containing filter queries for the selected regular and hierarchical facets.- Parameters:
includeRangeFacets
- a boolean.- Returns:
- a
List
object.
-
getActiveFacetsForField
Returns a list of FacetItem objects inactiveFacets
where the field name matches the given field name.- Parameters:
field
- The field name to match.- Returns:
- a
List
object.
-
isFacetStringCurrentlyUsed
- Parameters:
link
-- Returns:
- true if given link is part of the active facet string; false otherwise
-
isFacetCurrentlyUsed
Checks whether the given facet is currently in use.- Parameters:
facet
- The facet to check.- Returns:
- a boolean.
-
isFacetListSizeSufficient
isFacetListSizeSufficient.
- Parameters:
field
- aString
object.- Returns:
- a boolean.
-
getAvailableFacetsListSizeForField
Returns the size of the full element list of the facet for the given field.- Parameters:
field
- aString
object.- Returns:
- a int.
-
getActiveFacetsSizeForField
getActiveFacetsSizeForField.
- Parameters:
field
- aString
object.- Returns:
- Size of
activeFacets
.
-
getLimitedFacetListForField
Returns a collapsed sublist of the available facet elements for the given field. -
getAvailableFacetsForField
- Parameters:
field
-excludeSelected
- If true, selected facets will be removed from the list- Returns:
- List
-
getFacet
- Parameters:
field
-value
-- Returns:
- Specific facet item for the given field and value; null if none found
-
isUnselectedValuesAvailable
public boolean isUnselectedValuesAvailable()Checks whether there are still selectable values across all available facet fields.- Returns:
- true if any available facet field has at least one unselected value; false otherwise
-
isHasRangeFacets
- Returns:
- true if any configured range facet field has a value range in the current search result; false otherwise
- Throws:
PresentationException
IndexUnreachableException
-
expandFacet
Sets the expanded flag totrue
for the given facet field.- Parameters:
field
- aString
object.
-
collapseFacet
Sets the expanded flag tofalse
for the given facet field.- Parameters:
field
- aString
object.
-
isDisplayFacetExpandLink
Returns true if the "(more)" link is to be displayed for a facet box. This is the case if the facet has more elements than the initial number of displayed elements and the facet hasn't been manually expanded yet.- Parameters:
field
- aString
object.- Returns:
- a boolean.
-
isDisplayFacetCollapseLink
isDisplayFacetCollapseLink.
- Parameters:
field
- aString
object.- Returns:
- a boolean.
-
getActiveFacetString
Returns a URL encoded SSV string of facet fields and values from the elements inactiveFacets
(hyphen if empty).- Returns:
- SSV string of facet queries or "-" if empty
-
setActiveFacetString
Receives an SSV string of facet fields and values (FIELD1:value1;FIELD2:value2;FIELD3:value3) and generates new Elements for currentFacets.- Parameters:
activeFacetString
- aString
object.
-
updateFacetItem
Updates existing facet item for the given field with a new value. If no item for that field yet exist, a new one is added. -
getHierarchicalFacets
getHierarchicalFacets.
-
splitHierarchicalFacet
splitHierarchicalFacet.
-
getCurrentMinRangeValue
public String getCurrentMinRangeValue(String field) throws PresentationException, IndexUnreachableException getCurrentMinRangeValue.
- Parameters:
field
- aString
object.- Returns:
- Current min value, if facet in use; otherwise absolute min value for that field
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getCurrentMaxRangeValue
public String getCurrentMaxRangeValue(String field) throws PresentationException, IndexUnreachableException getCurrentMaxRangeValue.
- Parameters:
field
- aString
object.- Returns:
- Current max value, if facet in use; otherwise absolute max value for that field
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getAbsoluteMinRangeValue
public String getAbsoluteMinRangeValue(String field) throws PresentationException, IndexUnreachableException Returns the minimum value for the given field available in the search index.- Parameters:
field
- aString
object.- Returns:
- Smallest available value
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getAbsoluteMaxRangeValue
public String getAbsoluteMaxRangeValue(String field) throws PresentationException, IndexUnreachableException Returns the maximum value for the given field available in the search index.- Parameters:
field
- aString
object.- Returns:
- Largest available value
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getValueRange
public List<Integer> getValueRange(String field) throws PresentationException, IndexUnreachableException Returns a sorted list of all available values for the given field among available facet values.- Parameters:
field
- aString
object.- Returns:
- sorted list of all values for the given field among available facet values
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getValueRangeAsJsonMap
- Parameters:
field
-- Returns:
String
-
isRangeFacetActive
- Parameters:
field
-- Returns:
- true if active range for field is currently smaller than the absolute range; false otherwise
-
resetActiveFacetString
public void resetActiveFacetString()resetActiveFacetString.
-
getActiveFacetStringPrefix
Returns a URL encoded value returned by generateFacetPrefix() for regular facets. Returns an empty string instead a hyphen if empty.- Returns:
- a
String
object.
-
getActiveFacetStringPrefix
- Parameters:
omitField
- Field name to not include in the string- Returns:
String
object.
-
getActiveFacetStringPrefix
Returns the value returned by generateFacetPrefix() for regular facets. Returns an empty string instead a hyphen if empty.- Parameters:
omitFields
- Field names to omit from the facet stringurlEncode
-- Returns:
- URL part for currently selected facets; empty string if empty
-
removeFacetAction
removeFacetAction.
-
isFacetExpanded
Returns true if the value for the given field type infacetsExpanded
has been previously set to true.- Parameters:
field
- aString
object.- Returns:
- a boolean.
-
isFacetCollapsed
isFacetCollapsed.
- Parameters:
field
- aString
object.- Returns:
- a boolean.
-
getAllRangeFacetFields
- Returns:
- All facet field names of the type "range"
-
getRangeFacetStyle
- Parameters:
field
-- Returns:
- Visualization style for the given range field
-
getRangeFacetMinValue
- Parameters:
field
-- Returns:
- Configured min value for the given field
-
getRangeFacetMaxValue
- Parameters:
field
-- Returns:
- Configured max value for the given field
-
getAllAvailableFacets
Returns configured facet fields of regular and hierarchical type only.
- Returns:
- a
Map
object.
-
hasAvailableFacets
public boolean hasAvailableFacets() -
getConfiguredSubelementFacetFields
getConfiguredSubelementFacetFields.
- Returns:
- Configured subelement fields names only
-
getAvailableFacets
Getter for the field
availableFacets
.- Returns:
- the availableFacets
-
getActiveFacets
Getter for the field
activeFacets
.- Returns:
- the activeFacets
-
getTempValue
Getter for the field
tempValue
.- Returns:
- the tempValue
-
setTempValue
Setter for the field
tempValue
.- Parameters:
tempValue
- the tempValue to set
-
isHasWrongLanguageCode
Returns true if the givenfield
is language-specific to a different language than the givenlanguage
. -
getFacetValue
getFacetValue.
-
getFacetDescription
getFacetDescription.
-
getFirstHierarchicalFacetValue
getFirstHierarchicalFacetValue.
- Returns:
- a
String
object.
-
getFirstHierarchicalFacetDescription
getFirstHierarchicalFacetDescription.
-
getLabelMap
- Returns:
- the labelMap
-
getGeoFacetting
- Returns:
- the geoFacetting
-
setGeoFacetFeature
Sets the feature of the geoFacettingfield to to given feature. A new GeoFacetItem is added to currentFacets if none exists yet- Parameters:
feature
-
-
getGeoFacetFeature
-
getActiveFacetsSize
public int getActiveFacetsSize()
-