Class Search

java.lang.Object
io.goobi.viewer.model.search.Search
All Implemented Interfaces:
Serializable

@Entity public class Search extends Object implements Serializable
Persistable search query.
See Also:
  • Constructor Details

    • Search

      public Search()
      Empty constructor for JPA.
    • Search

      public Search(Search blueprint)
      cloning constructor. Creates a new search in a state as it might be loaded from database, i.e. without any transient fields set. In particular with empty getHits()
      Parameters:
      blueprint -
    • Search

      public Search(int searchType, SearchFilter searchFilter, List<SearchResultGroup> resultGroups)

      Constructor for Search.

      Parameters:
      searchType - a int.
      searchFilter - a SearchFilter object.
      resultGroups -
    • Search

      public Search(int searchType, SearchFilter searchFilter, List<SearchResultGroup> resultGroups, List<String> facetFields)

      Constructor for Search.

      Parameters:
      searchType - a int.
      searchFilter - a SearchFilter object.
      resultGroups - the SearchResultGroups to search
      facetFields - the facet fields to use
  • Method Details

    • hashCode

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

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

      public String generateFinalSolrQuery(SearchFacets facets)
      Parameters:
      facets -
      Returns:
      Generated Solr query
      Throws:
      IndexUnreachableException
    • generateFinalSolrQuery

      public String generateFinalSolrQuery(SearchFacets facets, SearchAggregationType aggregationType)
      Parameters:
      facets -
      aggregationType -
      Returns:
      Generated Solr query
      Throws:
      IndexUnreachableException
    • execute

      public void execute(SearchFacets facets, Map<String,Set<String>> searchTerms, int hitsPerPage, Locale locale) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException

      execute.

      Parameters:
      facets - a SearchFacets object.
      searchTerms - a Map object.
      hitsPerPage - a int.
      locale - Selected locale
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • execute

      public void execute(SearchFacets facets, Map<String,Set<String>> searchTerms, int hitsPerPage, Locale locale, boolean keepSolrDoc, SearchAggregationType aggregationType) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException

      execute.

      Parameters:
      facets - a SearchFacets object.
      searchTerms - a Map object.
      hitsPerPage - a int.
      locale - Selected locale
      keepSolrDoc -
      aggregationType -
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getLocations

      protected static List<IArea> getLocations(Object o)
      Parameters:
      o -
      Returns:
      List
    • getPoints

      protected static double[][] getPoints(String value)
      Parameters:
      value -
      Returns:
      double[][]
    • parsePoint

      protected static double[] parsePoint(Object x, Object y)
      Parameters:
      x -
      y -
      Returns:
      double[][]
    • getUrl

      public String getUrl() throws UnsupportedEncodingException
      Constructs a search URL using the query parameters contained in this object.
      Returns:
      a String object.
      Throws:
      UnsupportedEncodingException - if any.
    • getId

      public Long getId()

      Getter for the field id.

      Returns:
      the id
    • setId

      public void setId(Long id)

      Setter for the field id.

      Parameters:
      id - the id to set
    • getOwner

      public User getOwner()

      Getter for the field owner.

      Returns:
      the owner
    • setOwner

      public void setOwner(User owner)

      Setter for the field owner.

      Parameters:
      owner - the owner to set
    • getName

      public String getName()

      Getter for the field name.

      Returns:
      the name
    • setName

      public void setName(String name)

      Setter for the field name.

      Parameters:
      name - the name to set
    • getUserInput

      public String getUserInput()

      Getter for the field userInput.

      Returns:
      the userInput
    • setUserInput

      public void setUserInput(String userInput)

      Setter for the field userInput.

      Parameters:
      userInput - the userInput to set
    • getSearchType

      public int getSearchType()

      Getter for the field searchType.

      Returns:
      the searchType
    • setSearchType

      public void setSearchType(int searchType)

      Setter for the field searchType.

      Parameters:
      searchType - the searchType to set
    • getSearchFilter

      public String getSearchFilter()

      Getter for the field searchFilter.

      Returns:
      the searchFilter
    • setSearchFilter

      public void setSearchFilter(String searchFilter)

      Setter for the field searchFilter.

      Parameters:
      searchFilter - the searchFilter to set
    • getQuery

      public String getQuery()

      Getter for the field query.

      Returns:
      the query
    • setQuery

      public void setQuery(String query)

      Setter for the field query.

      Parameters:
      query - the query to set
    • getExpandQuery

      public String getExpandQuery()

      Getter for the field expandQuery.

      Returns:
      the expandQuery
    • setExpandQuery

      public void setExpandQuery(String expandQuery)

      Setter for the field expandQuery.

      Parameters:
      expandQuery - the expandQuery to set
    • getCustomFilterQuery

      public String getCustomFilterQuery()
      Returns:
      the customFilterQuery
    • setCustomFilterQuery

      public void setCustomFilterQuery(String customFilterQuery)
      Parameters:
      customFilterQuery - the customFilterQuery to set
    • getPage

      public int getPage()

      Getter for the field page.

      Returns:
      the page
    • setPage

      public void setPage(int page)

      Setter for the field page.

      Parameters:
      page - the page to set
    • getFacetString

      public String getFacetString()

      Getter for the field facetString.

      Returns:
      the facetString
    • setFacetString

      public void setFacetString(String facetString)

      Setter for the field facetString.

      Parameters:
      facetString - the facetString to set
    • getSortString

      public String getSortString()

      Getter for the field sortString.

      Returns:
      the sortString
    • setSortString

      public void setSortString(String sortString)

      Setter for the field sortString.

      Parameters:
      sortString - the sortString to set
    • getSearchSortingOption

      public SearchSortingOption getSearchSortingOption()
      Returns:
      SearchSortingOption
    • setSearchSortingOption

      public void setSearchSortingOption(SearchSortingOption option)
      Parameters:
      option -
    • getAllSortFields

      public List<StringPair> getAllSortFields()
      Returns a list of currently selected sort fields with any configured static sort fields.
      Returns:
      A list of both static and selected fields
    • getSortFields

      public List<StringPair> getSortFields()

      Getter for the field sortFields.

      Returns:
      the sortFields
    • getDateUpdated

      public LocalDateTime getDateUpdated()

      Getter for the field dateUpdated.

      Returns:
      the dateUpdated
    • setDateUpdated

      public void setDateUpdated(LocalDateTime dateUpdated)

      Setter for the field dateUpdated.

      Parameters:
      dateUpdated - the dateUpdated to set
    • getLastHitsCount

      public long getLastHitsCount()

      Getter for the field lastHitsCount.

      Returns:
      the lastHitsCount
    • setLastHitsCount

      public void setLastHitsCount(long lastHitsCount)

      Setter for the field lastHitsCount.

      Parameters:
      lastHitsCount - the lastHitsCount to set
    • isNewHitsNotification

      public boolean isNewHitsNotification()

      isNewHitsNotification.

      Returns:
      the newHitsNotification
    • setNewHitsNotification

      public void setNewHitsNotification(boolean newHitsNotification)

      Setter for the field newHitsNotification.

      Parameters:
      newHitsNotification - the newHitsNotification to set
    • getProximitySearchDistance

      public int getProximitySearchDistance()
      Returns:
      the proximitySearchDistance
    • setProximitySearchDistance

      public void setProximitySearchDistance(int proximitySearchDistance)
      Parameters:
      proximitySearchDistance - the proximitySearchDistance to set
    • getResultGroups

      public List<SearchResultGroup> getResultGroups()
      Returns:
      the resultGroups
    • setResultGroups

      public void setResultGroups(List<SearchResultGroup> resultGroups)
      Parameters:
      resultGroups - the resultGroups to set
    • isSaved

      public boolean isSaved()

      isSaved.

      Returns:
      the saved
    • setSaved

      public void setSaved(boolean saved)

      Setter for the field saved.

      Parameters:
      saved - the saved to set
    • getHitsCount

      public long getHitsCount()

      Getter for the field hitsCount.

      Returns:
      the hitsCount
    • setHitsCount

      public void setHitsCount(long hitsCount)

      Setter for the field hitsCount.

      Parameters:
      hitsCount - the hitsCount to set
    • getHits

      public List<SearchHit> getHits()

      Getter for the field hits.

      Returns:
      the hits
    • getLastPage

      public int getLastPage(int hitsPerPage)

      getLastPage.

      Parameters:
      hitsPerPage - a int.
      Returns:
      a int.
    • toggleNotifications

      public void toggleNotifications() throws DAOException
      Toggles the status of newHitsNotification and persists this search.
      Throws:
      DAOException - if any.
    • getHitsLocationList

      public List<Location> getHitsLocationList()
      Returns:
      the hitGeoCoordinateList
    • isHasGeoLocationHits

      public boolean isHasGeoLocationHits()
      Returns:
      the hasGeoLocationHits
    • isGroupPreviewMode

      public boolean isGroupPreviewMode()
      Returns:
      true if resultGroups larger than 1; false otherwise
    • getMetadataListType

      public String getMetadataListType()
      Returns:
      the metadataListType
    • setMetadataListType

      public void setMetadataListType(String metadataListType)
      Parameters:
      metadataListType - the metadataListType to set
    • getFacetFields

      public List<String> getFacetFields()