Class SearchBean

java.lang.Object
io.goobi.viewer.managedbeans.SearchBean
All Implemented Interfaces:
SearchInterface, Serializable

@Named @SessionScoped public class SearchBean extends Object implements SearchInterface, Serializable
JSF session-scoped backing bean for the search interface, managing search queries, facets, sorting, and result pagination. Initialised via @PostConstruct init() which resets the advanced search parameters to their defaults.

Lifecycle: Created once per HTTP session by the CDI container; survives across multiple page navigations within the same session and is destroyed when the session expires.

Thread safety: Mostly confined to the JSF request thread of the owning session. The async Excel-export download state (downloadReady, downloadComplete) is held in volatile fields and guarded by a synchronized block to allow safe hand-off between the JSF thread and the background download thread.

See Also:
  • Field Details

  • Constructor Details

    • SearchBean

      public SearchBean()
      Empty constructor.
  • Method Details

    • shutdown

      public static void shutdown()
      Shuts down the static executor. Should be called from the servlet context listener on undeploy.
    • init

      @PostConstruct public void init()
      init.
    • setNavigationHelper

      public void setNavigationHelper(NavigationHelper navigationHelper)
      Required setter for ManagedProperty injection for unit tests.
      Parameters:
      navigationHelper - the NavigationHelper instance to inject for testing
    • clearSearchItemLists

      public void clearSearchItemLists()
      clearSearchItemLists.
    • search

      Dummy method for component cross-compatibility with CMS searches.
      Returns:
      Navigation outcome
      Throws:
      PresentationException
      IndexUnreachableException
      DAOException
      ViewerConfigurationException
    • getEffectiveFilterQuery

      public String getEffectiveFilterQuery()
    • search

      Executes the search using already set parameters. Usually called from Pretty URLs.
      Parameters:
      filterQuery - additional Solr filter query to restrict results
      Returns:
      Navigation outcome
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • searchSimple

      public String searchSimple()
      Perform a simple Search.

      Action method for search buttons (simple search).

      Specified by:
      searchSimple in interface SearchInterface
      Returns:
      the url to navigate to, or an empty string if naviation is handled internally
    • searchSimple

      public String searchSimple(boolean resetParameters)
      Action method for search buttons (simple search) with an option to reset search parameters.
      Parameters:
      resetParameters - true to reset sort, filter and page before searching
      Returns:
      Navigation outcome
    • searchSimple

      public String searchSimple(boolean resetParameters, boolean resetFacets)
      Action method for search buttons (simple search) with an option to reset search parameters and active facets.
      Parameters:
      resetParameters - true to reset sort, filter and page before searching
      resetFacets - true to clear all active facet selections
      Returns:
      Navigation outcome
    • simpleSearch

      public String simpleSearch(SearchInterface search)
      simpleSearch.
      Parameters:
      search - search interface to trigger simple search on
      Returns:
      Navigation outcome
    • searchSimpleResetCollections

      public String searchSimpleResetCollections()
      Same as searchSimple() but resets the current facets.
      Returns:
      Navigation outcome
    • searchSimpleSetFacets

      public String searchSimpleSetFacets(String facetString)
      Same as searchSimple() but sets the current facets to the given string.
      Parameters:
      facetString - encoded facet selection string to apply before searching
      Returns:
      Navigation outcome
    • searchAdvanced

      public String searchAdvanced()
      Perform an advanced Search.
      Specified by:
      searchAdvanced in interface SearchInterface
      Returns:
      the url to navigate to, or an empty string if naviation is handled internally
    • searchAdvanced

      public String searchAdvanced(boolean resetParameters)
      searchAdvanced.
      Parameters:
      resetParameters - true to reset sort, filter and page before searching
      Returns:
      Navigation outcome
    • searchDirect

      public String searchDirect()
      Searches using currently set search string.
      Returns:
      Navigation outcome
    • searchToday

      public String searchToday()
      Executes a search for any content tagged with today's month and day.
      Returns:
      Navigation outcome
    • resetSearchAction

      public String resetSearchAction()
      Action method for the "reset" button in search forms.
      Returns:
      Navigation outcome
    • reset

      public void reset()
      Same as resetSearchAction() without the redirect.
    • resetSearch

      public String resetSearch()
      Resets the current search including all results and search parameters.

      Alias for resetSearchAction()

      Specified by:
      resetSearch in interface SearchInterface
      Returns:
      the url to navigate to, or an empty string if naviation is handled internally
    • resetSearchResults

      public void resetSearchResults()
      Resets variables that hold search result data. Does not reset search parameter variables such as type, filter or collection.
    • resetSearchParameters

      public void resetSearchParameters()
      Resets general search options and type specific options for currently unused types.
    • resetSearchParameters

      public void resetSearchParameters(boolean resetAllSearchTypes)
      resetSearchParameters.
      Parameters:
      resetAllSearchTypes - true to also reset parameters for the currently active search type
    • resetSearchParameters

      public void resetSearchParameters(boolean resetAllSearchTypes, boolean resetCurrentPage)
      Resets general search options and type specific options for currently unused types (all options if is true).
      Parameters:
      resetAllSearchTypes - If true, parameters for the currently used search type are also reset.
      resetCurrentPage - If true, currentPage will be reset to 1
    • resetSimpleSearchParameters

      protected void resetSimpleSearchParameters()
      Resets search options for the simple search.
    • resetAdvancedSearchParameters

      protected void resetAdvancedSearchParameters()
      Resets search options for the advanced search.
    • setAdvancedQueryItemsReset

      public void setAdvancedQueryItemsReset(boolean reset)
      "Setter" for resetting the query item list via a f:setPropertyActionListener.
      Parameters:
      reset - true to reset advanced search query items to defaults
    • executeSearch

      executeSearch.
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • executeSearch

      executeSearch.
      Parameters:
      filterQuery - additional Solr filter query to restrict results
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • setLastUsedSearchPage

      public void setLastUsedSearchPage()
      Set the current ViewerPath as the lastUsedSearchPage. This is where returning to search hit list from record will direct to
    • getFinalSolrQuery

      public String getFinalSolrQuery()
      getFinalSolrQuery.
      Returns:
      the final Solr query string generated from the current or an empty search
    • getFilterQueries

      public List<String> getFilterQueries()
      getFilterQueries.
      Returns:
      a list of active Solr filter query strings from the current search and active facets
    • getCombinedFilterQuery

      public String getCombinedFilterQuery()
      getCombinedFilterQuery.
      Returns:
      Generated query
    • getActiveSearchType

      public int getActiveSearchType()
      Get the currently active search type. The possible types are defined in SearchHelper
      Specified by:
      getActiveSearchType in interface SearchInterface
      Returns:
      the active search type
    • getAdvancedSearchOrigin

      public AdvancedSearchOrigin getAdvancedSearchOrigin()
      Returns:
      the origin record from which the search was triggered, or null
    • setActiveSearchType

      public void setActiveSearchType(int activeSearchType)
      Set the search type to use. The possible types are defined in SearchHelper
      Specified by:
      setActiveSearchType in interface SearchInterface
      Parameters:
      activeSearchType - search type constant as defined in SearchHelper
    • resetActiveSearchType

      public void resetActiveSearchType()
      resetActiveSearchType.
    • autocomplete

      public List<String> autocomplete(String suggest) throws IndexUnreachableException
      Returns suggestions for autocomplete.
      Specified by:
      autocomplete in interface SearchInterface
      Parameters:
      suggest - partial input string to complete
      Returns:
      suggestions for autocomplete
      Throws:
      IndexUnreachableException - if any.
    • isSearchInDcFlag

      public boolean isSearchInDcFlag()
      Returns if search is performed only within a DC.
      Specified by:
      isSearchInDcFlag in interface SearchInterface
      Returns:
      true if the search is restricted to a specific DC (collection) field, false otherwise
    • isSearchInFacetFieldFlag

      public boolean isSearchInFacetFieldFlag(String fieldName)
      Returns if search is performed only within a certain facet field.
      Specified by:
      isSearchInFacetFieldFlag in interface SearchInterface
      Parameters:
      fieldName - Solr facet field name to check
      Returns:
      true if the search is restricted to the given facet field, false otherwise
    • getInvisibleSearchString

      public String getInvisibleSearchString()
      Getter for the invisible (empty) search string. Used for the search field widget for when no search input display is desired.
      Returns:
      empty string
    • setInvisibleSearchString

      public void setInvisibleSearchString(String invisibleSearchString)
      The setter for the invisible search string. Performs all regular settings.
      Parameters:
      invisibleSearchString - search string value to apply silently
    • getSearchString

      public String getSearchString()
      Gets the current search string for display.
      Specified by:
      getSearchString in interface SearchInterface
      Returns:
      the current search string for display
    • getSearchStringForUrl

      public String getSearchStringForUrl()
      Wrapper method for Pretty URL mappings (so that the values is never empty).
      Returns:
      the current search query string sanitized for use in a Pretty URL, or "-" if blank
    • setSearchStringForUrl

      public void setSearchStringForUrl(String searchString)
      Wrapper method for Pretty URL mappings.
      Parameters:
      searchString - URL-decoded search string from the Pretty URL
    • setSearchString

      public void setSearchString(String searchString)
      Sets the actual search string.

      Wrapper for setSearchStringKeepCurrentPage() that also resets currentPage.

      Specified by:
      setSearchString in interface SearchInterface
      Parameters:
      searchString - raw search query to set
    • getExactSearchString

      public String getExactSearchString()
      Gets the actual search string.
      Specified by:
      getExactSearchString in interface SearchInterface
      Returns:
      the actual search string
    • setExactSearchString

      public void setExactSearchString(String inSearchString)
      Sets the current searchStringInternal to the given query, without parsing it like the regular setSearchString() method. This method performs URL-unescaping, so using it directly with unescaped queries containing '+' etc. will change the logic.
      Parameters:
      inSearchString - URL-encoded Solr query string from the Pretty URL
    • setSortString

      public void setSortString(String sortString)
      Sets the sorting search string.
      Specified by:
      setSortString in interface SearchInterface
      Parameters:
      sortString - sort field and direction encoded as search string
    • getSortString

      public String getSortString()
      Returns the search string for the selected sort option.
      Specified by:
      getSortString in interface SearchInterface
      Returns:
      the search string for the selected sort option
    • getSearchSortingOption

      public SearchSortingOption getSearchSortingOption()
      Getter for the field searchSortingOption.
      Returns:
      the currently active sort option applied to search results
    • setSearchSortingOption

      public void setSearchSortingOption(SearchSortingOption searchSortingOption)
      Setter for the field searchSortingOption.
      Parameters:
      searchSortingOption - the sort option to apply to the current search results
    • getResultGroupsForSearchExecution

      public List<SearchResultGroup> getResultGroupsForSearchExecution()
      Returns relevant search result groups for search execution. If an active group is set, return just that. Otherwise, return either all configured groups or default group (if groups disabled).
      Returns:
      Relevant search result groups
    • isDisplayResultGroupNames

      public boolean isDisplayResultGroupNames()
      isDisplayResultGroupNames.
      Returns:
      true if activeResultGroup null; false otherwise
    • getActiveContext

      public String getActiveContext()
      getActiveContext.
      Specified by:
      getActiveContext in interface SearchInterface
      Returns:
      activeResultGroup name; "-" if none set
    • setActiveResultGroup

      public void setActiveResultGroup(SearchResultGroup activeResultGroup)
      Setter for the field activeResultGroup.
      Parameters:
      activeResultGroup - search result group to activate, or null to deactivate
    • setActiveContext

      public void setActiveContext(String activeContext)
      Depending on configuration settings, sets the given value as the active search result group name and/or active advanced search template.
      Specified by:
      setActiveContext in interface SearchInterface
      Parameters:
      activeContext - Name of the active context
    • getActiveResultGroupName

      public String getActiveResultGroupName()
      getActiveResultGroupName. For URL building, use getActiveContext() instead.
      Returns:
      activeResultGroup name; "-" if none set
    • setActiveResultGroupName

      public void setActiveResultGroupName(String activeResultGroupName)
      Sets activeResultGroup via the given name.
      Parameters:
      activeResultGroupName - Name of the active context
    • getAdvancedSearchFieldTemplate

      public String getAdvancedSearchFieldTemplate()
    • setAdvancedSearchFieldTemplate

      public void setAdvancedSearchFieldTemplate(String advancedSearchFieldTemplate)
      Parameters:
      advancedSearchFieldTemplate - Template name for advanced search fields
    • mirrorAdvancedSearchCurrentHierarchicalFacets

      public void mirrorAdvancedSearchCurrentHierarchicalFacets()
      Matches the selected collection item in the advanced search to the current value of currentCollection.
    • removeRangeFacetAction

      public String removeRangeFacetAction(String field)
      removeRangeFacetAction.
      Parameters:
      field - Solr field name of the range facet to remove
      Returns:
      Navigation outcome
    • removeFacetAction

      public String removeFacetAction(String facetQuery)
      removeFacetAction.
      Parameters:
      facetQuery - encoded facet query string identifying the facet to remove
      Returns:
      Navigation outcome
    • getCurrentPage

      public int getCurrentPage()
      Returns the current result list page number.
      Specified by:
      getCurrentPage in interface SearchInterface
      Returns:
      the current result list page number
    • setCurrentPage

      public void setCurrentPage(int currentPage)
      Setter for the field currentPage.
      Parameters:
      currentPage - the 1-based page number to navigate to in the search results
    • getHitsCount

      public long getHitsCount()
      Get total number of hits of the last search.
      Specified by:
      getHitsCount in interface SearchInterface
      Returns:
      the total number of hits of the last search
    • setHitsCount

      public void setHitsCount(long hitsCount)
      setHitsCount.
      Parameters:
      hitsCount - the total number of search hits to store on the current search
    • getSearchTerms

      public Map<String,Set<String>> getSearchTerms()
      Getter for the field searchTerms.
      Returns:
      map of Solr field names to the set of search terms entered for each field
    • getCurrentHitIndex

      public int getCurrentHitIndex()
      Getter for the field currentHitIndex.
      Returns:
      the zero-based index of the currently displayed search hit
    • getCurrentHitIndexDisplay

      public int getCurrentHitIndexDisplay()
      getCurrentHitIndexDisplay.
      Returns:
      a int.
    • increaseCurrentHitIndex

      public void increaseCurrentHitIndex()
      increaseCurrentHitIndex.
    • getHitIndexOperand

      public int getHitIndexOperand()
      Getter for the field hitIndexOperand.
      Returns:
      the operand used to calculate the next or previous hit index when navigating between hits
    • setHitIndexOperand

      public void setHitIndexOperand(int hitIndexOperand)
      Setter for the field hitIndexOperand.
      Parameters:
      hitIndexOperand - the operand used to calculate the next or previous hit index to navigate to
    • findCurrentHitIndex

      public void findCurrentHitIndex(String pi, int page, boolean aggregateHits)
      Returns the index of the currently displayed BrowseElement, if it is present in the search hit list.
      Parameters:
      pi - Record identifier of the loaded record.
      page - Page number of he loaded record.
      aggregateHits - If true, only the identifier has to match, page number is ignored.
    • getNextElement

      Returns the next BrowseElement in the hit list relative to the given index.
      Returns:
      Next BrowseElement in the list; same BrowseElement if this is the last index in the list; null if search is not initialized
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getPreviousElement

      Returns the previous BrowseElement in the hit list relative to the given index.
      Returns:
      Previous BrowseElement in the list; same BrowseElement if this is the first index in the list; null if search is not initialized
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getSearchFilters

      public List<SearchFilter> getSearchFilters()
      Gets a list of all available search filters.
      Specified by:
      getSearchFilters in interface SearchInterface
      Returns:
      a list of all available search filters
    • getCurrentSearchFilterString

      public String getCurrentSearchFilterString()
      Returns the current search filter as string.
      Specified by:
      getCurrentSearchFilterString in interface SearchInterface
      Returns:
      the current search filter as string
    • setCurrentSearchFilterString

      public void setCurrentSearchFilterString(String searchFilterLabel)
      Sets the current search filter as string.

      Sets currentSearchFilter via the given label value.

      Specified by:
      setCurrentSearchFilterString in interface SearchInterface
      Parameters:
      searchFilterLabel - search filter identifier string to activate
    • resetSearchFilter

      public void resetSearchFilter()
      resetSearchFilter.
    • resetCurrentHitIndex

      public void resetCurrentHitIndex()
      resetCurrentHitIndex.
    • isSortingEnabled

      public boolean isSortingEnabled()
      isSortingEnabled.
      Returns:
      true if search result sorting is enabled in the configuration, false otherwise
    • getAdvancedSearchQueryGroup

      public SearchQueryGroup getAdvancedSearchQueryGroup()
      Getter for the field advancedSearchQueryGroup.
      Returns:
      the root query group containing all advanced search field conditions
    • getAdvancedSearchSelectItems

      public List<StringPair> getAdvancedSearchSelectItems(String field, String language, boolean hierarchical) throws PresentationException, IndexUnreachableException, DAOException
      Populates the list of advanced search drop-down values for the given field. List is only generated once per user session.
      Parameters:
      field - The index field for which to get drop-down values.
      language - Translation language for the values.
      hierarchical - If true, the menu items will be listed in their corresponding hierarchy (e.g. DC)
      Returns:
      a list of label/value pairs for use in advanced search drop-down menus for the given field
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
    • getAllCollections

      public List<StringPair> getAllCollections()
      Returns drop-down items for all collection names. Convenience method that retrieves the current language from NavigationHelper.

      This method shouldn't throw exceptions, otherwise it can cause an IllegalStateException.

      Returns:
      a list of label/value pairs for all available collection names in the current user's language
    • getAllCollections

      public List<StringPair> getAllCollections(String language) throws PresentationException, IndexUnreachableException, DAOException
      Returns drop-down items for all collection names. The displayed values are translated into the given language.
      Parameters:
      language - BCP 47 language tag for translating collection labels
      Returns:
      a list of label/value pairs for all available collection names translated into the given language
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
    • getAdvancedSearchAllowedFields

      public List<AdvancedSearchFieldConfiguration> getAdvancedSearchAllowedFields()
      getAdvancedSearchAllowedFields.
      Returns:
      List of allowed advanced search fields
    • getAdvancedSearchFirstItemAllowedFields

      public List<AdvancedSearchFieldConfiguration> getAdvancedSearchFirstItemAllowedFields()
    • getAdvancedSearchAllowedFields

      public static List<AdvancedSearchFieldConfiguration> getAdvancedSearchAllowedFields(String language, String template, boolean addSearchFilters)
      Returns index field names allowed for advanced search use. If language-specific index fields are used, those that don't match the current locale are omitted.
      Parameters:
      language - Optional language code for filtering language-specific fields
      template - advanced search field configuration template name
      addSearchFilters - If true, prepend configured search filters as fields
      Returns:
      List of allowed advanced search fields
    • getCurrentSearch

      public Search getCurrentSearch()
      Getter for the field currentSearch.
      Returns:
      the Search object representing the active search query and its results
    • setCurrentSearch

      public void setCurrentSearch(Search currentSearch)
      Setter for the field currentSearch.
      Parameters:
      currentSearch - the Search object representing the active search query and its results
    • isFuzzySearchEnabled

      public boolean isFuzzySearchEnabled()
      isFuzzySearchEnabled.
      Returns:
      true if fuzzy matching is enabled for search queries, false otherwise
    • setFuzzySearchEnabled

      public void setFuzzySearchEnabled(boolean fuzzySearchEnabled)
      Setter for the field fuzzySearchEnabled.
      Parameters:
      fuzzySearchEnabled - true to enable fuzzy matching in search queries, false for exact matching
    • saveSearchAction

      public String saveSearchAction() throws DAOException
      saveSearchAction.
      Returns:
      the empty navigation outcome string after persisting the current search
      Throws:
      DAOException - if any.
    • getRssUrl

      public String getRssUrl() throws ViewerConfigurationException
      Returns the URL to the RSS feed for the current search.
      Returns:
      RSS feed URL, or null if no search string is set
      Throws:
      ViewerConfigurationException - if any.
    • isSearchSavingEnabled

      public boolean isSearchSavingEnabled()
      isSearchSavingEnabled.
      Returns:
      true if saving searches is enabled in the configuration, false otherwise
    • executeSavedSearchAction

      public String executeSavedSearchAction(Search search)
      executeSavedSearchAction.
      Parameters:
      search - previously saved search object to re-execute
      Returns:
      the navigation outcome string after restoring and executing the saved search, or null if the redirect URL cannot be built
    • exportSearchAsRisAction

      public String exportSearchAsRisAction() throws IndexUnreachableException
      exportSearchAsRisAction.
      Returns:
      the empty navigation outcome string after writing the RIS export to the HTTP response
      Throws:
      IndexUnreachableException - if any.
    • exportSearchAsExcelAction

      public String exportSearchAsExcelAction() throws IndexUnreachableException
      exportSearchAsExcelAction.
      Returns:
      an empty string after initiating the Excel export response
      Throws:
      IndexUnreachableException - if any.
    • getHitsPerPage

      public int getHitsPerPage()
      Getter for the field hitsPerPage.
      Returns:
      the number of search results displayed per page
    • setHitsPerPage

      public void setHitsPerPage(int hitsPerPage)
      Setter for the field hitsPerPage.
      Parameters:
      hitsPerPage - the number of search results to display per page
    • setHitsPerPageNoTrigger

      public void setHitsPerPageNoTrigger(int hitsPerPage)
      Like setHitsPerPage() but doesn't trigger the boolean.
      Parameters:
      hitsPerPage - the number of search results to display per page
    • isHitsPerPageSetterCalled

      public boolean isHitsPerPageSetterCalled()
      isHitsPerPageSetterCalled.
      Returns:
      true if the hits-per-page setter has been explicitly invoked during the current request, false otherwise
    • setHitsPerPageSetterCalled

      public void setHitsPerPageSetterCalled(boolean hitsPerPageSetterCalled)
      Setter for the field hitsPerPageSetterCalled.
      Parameters:
      hitsPerPageSetterCalled - true if the hits-per-page setter has been explicitly invoked during the current request
    • getAdvancedSearchQueryInfo

      public String getAdvancedSearchQueryInfo()
      Getter for the field advancedSearchQueryInfo.
      Returns:
      the HTML-escaped human-readable description of the current advanced search query
    • getFacets

      public SearchFacets getFacets()
      List all current SearchFacets.
      Specified by:
      getFacets in interface SearchInterface
      Returns:
      all current SearchFacets
    • isDownloadReady

      public Future<Boolean> isDownloadReady()
      isDownloadReady.
      Returns:
      a Future resolving to true when the export download is ready
    • getTotalNumberOfVolumes

      public long getTotalNumberOfVolumes() throws IndexUnreachableException, PresentationException
      getTotalNumberOfVolumes.
      Returns:
      a long.
      Throws:
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getSearchUrl

      public String getSearchUrl()
      Returns the proper search URL part for the current search type.
      Returns:
      the URL for the search page matching the currently active search type
    • getLastPage

      public int getLastPage()
      Returns the last result list page number.
      Specified by:
      getLastPage in interface SearchInterface
      Returns:
      the last result list page number
    • getStructElement

      getStructElement.
      Parameters:
      pi - persistent identifier of the record
      Returns:
      the top-level StructElement for the record with the given PI
      Throws:
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getCurrentSearchUrlRoot

      public String getCurrentSearchUrlRoot()
      Returns the base url of the current search page, without any search parameters.
      Specified by:
      getCurrentSearchUrlRoot in interface SearchInterface
      Returns:
      the base url of the current search page, without any search parameters
    • getCurrentSearchUrlPart

      public String getCurrentSearchUrlPart()
      getCurrentSearchUrlPart.
      Returns:
      Parameter string for pretty:search5 URLs.
    • updateFacetItem

      public void updateFacetItem(String field, boolean hierarchical)
      updateFacetItem.
      Parameters:
      field - Solr field name of the facet to update
      hierarchical - true if the field uses hierarchical faceting
    • getStaticFacets

      public List<IFacetItem> getStaticFacets(String field, String subQuery, Integer resultLimit, Boolean reverseOrder) throws PresentationException, IndexUnreachableException
      Returns a list of FilterLink elements for the given field over all documents in the index (optionally filtered by a subquery). Replaces the method in the old TagLib class.
      Parameters:
      field - Solr field name to retrieve facet values for
      subQuery - optional Solr sub-query to filter the facet base set
      resultLimit - maximum number of facet values to return
      reverseOrder - true to sort facet values in reverse order
      Returns:
      a list of facet items for the given field over all indexed documents, optionally filtered by the sub-query
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • isSearchPerformed

      public boolean isSearchPerformed()
      Checks if a search has been performed and any results are to be excepted (provided the search yielded any).
      Specified by:
      isSearchPerformed in interface SearchInterface
      Returns:
      whether a search has been performed after the last reset
    • isExplicitSearchPerformed

      public boolean isExplicitSearchPerformed()
      Checks if a search has been triggered by the user and not yet been reset.
      Specified by:
      isExplicitSearchPerformed in interface SearchInterface
      Returns:
      if a search has been triggered by the user and not yet been reset
    • setFirstQueryItemValue

      public void setFirstQueryItemValue(String value)
      setFirstQueryItemValue.
      Parameters:
      value - search term to set on the first advanced query item
    • getFirstQueryItemValue

      public void getFirstQueryItemValue()
      getFirstQueryItemValue.
    • setBookmarkListName

      public void setBookmarkListName(String name)
      setBookmarkListName.
      Parameters:
      name - bookmark list name to set as advanced search query value
    • getBookmarkListName

      public String getBookmarkListName()
      getBookmarkListName.
      Returns:
      name of the bookmark list set in the advanced search query
    • setBookmarkListSharedKey

      public void setBookmarkListSharedKey(String key)
      setBookmarkListName.
      Parameters:
      key - The sharing key to set
    • getBookmarkListSharedKey

      public String getBookmarkListSharedKey()
      getBookmarkListName.
      Returns:
      sharing key of the bookmark list set in the advanced search query
    • getProximitySearchDistance

      public int getProximitySearchDistance()
      Getter for the field proximitySearchDistance.
      Returns:
      a int
    • searchInRecord

      public String searchInRecord(String piField, String piValue)
      searchInRecord.
      Parameters:
      piField - Solr field name holding the record identifier
      piValue - persistent identifier value to restrict the search to
      Returns:
      Navigation outcome
    • searchInRecord

      public String searchInRecord(String piField, String piValue, String date1, String date2)
      searchInRecord.
      Parameters:
      piField - Solr field name holding the record identifier
      piValue - persistent identifier value to restrict the search to
      date1 - Start date for the calendar day range filter
      date2 - End date for the calendar day range filter
      Returns:
      Navigation outcome
    • searchInField

      public String searchInField(String queryField)
      Executes an advanced search using the given field. The search value is set via the HTML component using this method.
      Parameters:
      queryField - Advanced search field to query
      Returns:
      Navigation outcome
    • isSolrIndexReachable

      public boolean isSolrIndexReachable()
      isSolrIndexReachable.
      Returns:
      true if Solr ping successful; false otherwise
    • hasGeoLocationHits

      public boolean hasGeoLocationHits()
      hasGeoLocationHits.
      Specified by:
      hasGeoLocationHits in interface SearchInterface
      Returns:
      true if the current search results contain records with geo-location data, false otherwise
    • getHitsLocations

      public List<String> getHitsLocations()
      getHitsLocations.
      Returns:
      a list of GeoJSON strings for each search hit that has geographic coordinates
    • isShowGeoFacetMap

      public boolean isShowGeoFacetMap()
      Display the geo facet map if there are any hits available with geo coordinates.
      Returns:
      true if search hits with coordinates available; false otherwise
    • getHitsMap

      public GeoMap getHitsMap()
      getHitsMap.
      Specified by:
      getHitsMap in interface SearchInterface
      Returns:
      a GeoMap populated with the geo-location hits from the current search result
    • facetifyField

      public String facetifyField(String fieldName)
      facetifyField.
      Parameters:
      fieldName - Solr field name to convert to its facet variant
      Returns:
      Facet variant of the given fieldName
    • getFieldFacetValues

      public List<FacetItem> getFieldFacetValues(String field, int num) throws IndexUnreachableException
      getFieldFacetValues.
      Parameters:
      field - Solr field name to retrieve facet values for
      num - maximum number of facet values to return; 0 for unlimited
      Returns:
      List of facet values for the given field
      Throws:
      IndexUnreachableException
    • getFieldFacetValues

      public List<FacetItem> getFieldFacetValues(String field, int num, String filterQuery) throws IndexUnreachableException
      getFieldFacetValues.
      Parameters:
      field - Solr field name to retrieve facet values for
      num - maximum number of facet values to return; 0 for unlimited
      filterQuery - additional Solr filter query to restrict the facet base set
      Returns:
      List of facet values for the given field
      Throws:
      IndexUnreachableException
    • getSearchSortingOptions

      public Collection<SearchSortingOption> getSearchSortingOptions(String language)
      getSearchSortingOptions.
      Parameters:
      language - BCP 47 language tag for translating sort option labels
      Returns:
      List of sorting options for the given language
    • getQueryResultCount

      public long getQueryResultCount(String query) throws IndexUnreachableException, PresentationException
      getQueryResultCount.
      Parameters:
      query - Solr query to count results for
      Returns:
      Number of hits for the given query
      Throws:
      IndexUnreachableException
      PresentationException
    • getFinalSolrQueryEscaped

      public String getFinalSolrQueryEscaped()
      getFinalSolrQueryEscaped.
      Returns:
      URL-encoded final query
    • getCombinedFilterQueryEscaped

      public String getCombinedFilterQueryEscaped()
      getCombinedFilterQueryEscaped.
      Returns:
      URL-encoded combined filter query
    • getFilterQuery

      public String getFilterQuery()
    • setFilterQuery

      public void setFilterQuery(String filterQuery)
    • getLastUsedSearchUrl

      public String getLastUsedSearchUrl()
      The url of the viewer page loaded when the last search operation was performed, stored in lastUsedSearchPage or the url of the default search or searchAdvanced page depending on the state of this bean.
      Returns:
      a URL string
    • changeSorting

      public String changeSorting() throws IOException
      Action to execute to change the sort order of hits.
      Specified by:
      changeSorting in interface SearchInterface
      Returns:
      Navigation outcome
      Throws:
      IOException
    • getHttpRequest

      public HttpServletRequest getHttpRequest()