Class SearchSession


  • public class SearchSession
    extends Object

    Contains data associated with the current user and search session.

    Session features must be enabled on the collection and the application container session management must be properly configured.

    Since:
    12.5
    • Field Detail

      • searchUser

        private final SearchUser searchUser

        User performing the search.

        Will be the same across multiple searches for a given user.

      • searchHistory

        private final List<SearchHistory> searchHistory
        Search history of the user for the current collection.
      • clickHistory

        private final List<ClickHistory> clickHistory
        Click history of the user for the current collection.
      • resultsCart

        private final List<CartResult> resultsCart
        Results cart of the user for the current collection
        Since:
        12.4
    • Constructor Detail

      • SearchSession

        public SearchSession​(SearchUser searchUser)
    • Method Detail

      • cartContains

        public boolean cartContains​(String indexUrl)
        Check if the cart contains a specific result
        Parameters:
        indexUrl - URL of the result from the index
        Returns:
        true if the cart contains this result, false otherwise
      • getClickHistory

        public ClickHistory getClickHistory​(String indexUrl)
        Retrieve the clich history for a specific result
        Parameters:
        indexUrl - URL of the result from the index
        Returns:
        The click history, or null if this result wasn't clicked.
      • getSearchUser

        public SearchUser getSearchUser()

        User performing the search.

        Will be the same across multiple searches for a given user.

      • getSearchHistory

        public List<SearchHistory> getSearchHistory()
        Search history of the user for the current collection.
      • getClickHistory

        public List<ClickHistory> getClickHistory()
        Click history of the user for the current collection.
      • getResultsCart

        public List<CartResult> getResultsCart()
        Results cart of the user for the current collection
        Since:
        12.4