Class SearchHistoryService

java.lang.Object
com.mindstore.backend.service.SearchHistoryService

@Service public class SearchHistoryService extends Object
Service class for search history entity
  • Field Details

    • searchHistoryRepository

      public final SearchHistoryRepository searchHistoryRepository
      Repository for the search history
  • Constructor Details

    • SearchHistoryService

      public SearchHistoryService(SearchHistoryRepository searchHistoryRepository)
      Search history service
      Parameters:
      searchHistoryRepository - repository for search history
  • Method Details

    • saveSearch

      public void saveSearch(String term)
      function: saving a search that the user made to the serach history repo
      Parameters:
      term - the term that we want to save
    • getRecentSearches

      public List<String> getRecentSearches()
      function: We return a list of maximum 10 strings that represent the most recent searches
      Returns:
      a list of strings with the recent searches