Class SearchFunctionality

java.lang.Object
io.goobi.viewer.model.cms.itemfunctionality.SearchFunctionality
All Implemented Interfaces:
Functionality, SearchInterface
Direct Known Subclasses:
QueryListFunctionality

public class SearchFunctionality extends Object implements Functionality, SearchInterface

SearchFunctionality class.

Author:
Florian Alpers
  • Constructor Details

    • SearchFunctionality

      public SearchFunctionality(String pageFacetString, String baseUrl)

      Constructor for SearchFunctionality.

      Parameters:
      pageFacetString - a String object.
      baseUrl - a String object.
  • Method Details

    • resetSearch

      public String resetSearch()
      Reset the current search including all results and search parameters
      Specified by:
      resetSearch in interface SearchInterface
      Returns:
      the url to navigate to, or an empty string if naviation is handled internally
    • redirectToSearchUrl

      public void redirectToSearchUrl(boolean keepUrlParameter)

      redirectToSearchUrl.

      Parameters:
      keepUrlParameter - a boolean.
    • searchSimple

      public String searchSimple()
      Perform a simple Search
      Specified by:
      searchSimple in interface SearchInterface
      Returns:
      the url to navigate to, or an empty string if naviation is handled internally
    • 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
    • searchFacetted

      public void searchFacetted()

      searchFacetted.

    • search

      search.

      Parameters:
      subtheme -
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getUrlPrefix

      public String getUrlPrefix()
      The part of the search url before the page number
      Returns:
      a String object.
    • getUrlSuffix

      public String getUrlSuffix()

      getUrlSuffix.

      Returns:
      a String object.
    • getUrlSuffix

      public String getUrlSuffix(String solrSortFields)
      The part of the search url after the page number
      Parameters:
      solrSortFields - a String object.
      Returns:
      a String object.
    • setPageNo

      public void setPageNo(int pageNo)

      setPageNo.

      Specified by:
      setPageNo in interface Functionality
      Parameters:
      pageNo - a int.
    • getPageNo

      public int getPageNo()

      getPageNo.

      Specified by:
      getPageNo in interface Functionality
      Returns:
      a int.
    • getCurrentPage

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

      public SearchBean getSearchBean()

      getSearchBean.

      Returns:
      the searchBean
    • getHitsPerPage

      public int getHitsPerPage()

      getHitsPerPage.

      Returns:
      the hitsPerPage
    • getActiveResultGroupName

      public String getActiveResultGroupName()
      Specified by:
      getActiveResultGroupName in interface SearchInterface
      Returns:
      The selected result group name
    • setActiveResultGroupName

      public void setActiveResultGroupName(String activeResultGroupName)
      Specified by:
      setActiveResultGroupName in interface SearchInterface
      Parameters:
      activeResultGroupName - a String object.
    • getSortString

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

      public void setSortString(String solrSortFields)
      Set the sorting search string
      Specified by:
      setSortString in interface SearchInterface
      Parameters:
      solrSortFields - a String object.
    • getFacetString

      public String getFacetString()

      getFacetString.

      Returns:
      the facetString
    • setFacetString

      public void setFacetString(String facetString)

      setFacetString.

      Parameters:
      facetString - the facetString to set
    • getQueryString

      public String getQueryString()

      getQueryString.

      Returns:
      a String object.
    • getExactSearchString

      public String getExactSearchString()
      Get the actual search string
      Specified by:
      getExactSearchString in interface SearchInterface
      Returns:
      the actual search string
    • setQueryString

      public void setQueryString(String s)

      setQueryString.

      Parameters:
      s - a String object.
    • getBaseUrl

      public String getBaseUrl()

      Getter for the field baseUrl.

      Returns:
      the baseUrl
    • getPageFacetString

      public String getPageFacetString()

      Getter for the field pageFacetString.

      Returns:
      the pageFacetString
    • getNewSearchUrl

      public String getNewSearchUrl()

      getNewSearchUrl.

      Returns:
      a String object.
    • changeSorting

      public String changeSorting() throws IOException
      Description copied from interface: SearchInterface
      action to execute to change sort sort order of hits
      Specified by:
      changeSorting in interface SearchInterface
      Returns:
      Navigation outcome
      Throws:
      IOException
    • getSortUrl

      public String getSortUrl(String sortString, boolean descending)

      getSortUrl.

      Parameters:
      sortString - a String object.
      descending - a boolean.
      Returns:
      a String object.
    • getFacettedUrl

      public String getFacettedUrl(String facetString)

      getFacettedUrl.

      Parameters:
      facetString - a String object.
      Returns:
      a String object.
    • removeFacet

      public String removeFacet(String facet)

      removeFacet.

      Parameters:
      facet - a String object.
      Returns:
      a String object.
    • getCurrentPagePath

      public String getCurrentPagePath()

      getCurrentPagePath.

      Returns:
      a String object.
    • isSearchInDcFlag

      public boolean isSearchInDcFlag()
      Return if search is performed only within a DC
      Specified by:
      isSearchInDcFlag in interface SearchInterface
      Returns:
      a boolean.
    • isSearchInFacetFieldFlag

      public boolean isSearchInFacetFieldFlag(String fieldName)
      Description copied from interface: SearchInterface
      Return if search is performed only within a certain facet field
      Specified by:
      isSearchInFacetFieldFlag in interface SearchInterface
      Returns:
      a boolean.
    • getFacets

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

      public List<String> autocomplete(String suggestion) throws IndexUnreachableException
      Return suggestions for autocomplete
      Specified by:
      autocomplete in interface SearchInterface
      Parameters:
      suggestion - a String object.
      Returns:
      suggestions for autocomplete
      Throws:
      IndexUnreachableException - if any.
    • getSearchString

      public String getSearchString()
      Get the current search string for display
      Specified by:
      getSearchString in interface SearchInterface
      Returns:
      the current search string for display
    • getSearchFilters

      public List<SearchFilter> getSearchFilters()
      Get 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()
      Return the current search filter as string
      Specified by:
      getCurrentSearchFilterString in interface SearchInterface
      Returns:
      the current search filter as string
    • setCurrentSearchFilterString

      public void setCurrentSearchFilterString(String filter)
      Set the current search filter as string
      Specified by:
      setCurrentSearchFilterString in interface SearchInterface
      Parameters:
      filter - a String object.
    • 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
    • setActiveSearchType

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

      public void setSearchString(String searchString)
      Set the actual search string
      Specified by:
      setSearchString in interface SearchInterface
      Parameters:
      searchString - a String object.
    • isSearchPerformed

      public boolean isSearchPerformed()
      Check 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
    • 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
    • getCurrentSearchUrlRoot

      public String getCurrentSearchUrlRoot()
      Return 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
    • getLastPage

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

      public boolean isExplicitSearchPerformed()
      Check 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
    • hasGeoLocationHits

      public boolean hasGeoLocationHits()
      Specified by:
      hasGeoLocationHits in interface SearchInterface
    • getHitsMap

      public GeoMap getHitsMap()
      Specified by:
      getHitsMap in interface SearchInterface