Class PopularWordHelper

java.lang.Object
org.codelibs.fess.helper.PopularWordHelper

public class PopularWordHelper extends Object
Helper class for managing popular words and suggestions. Provides functionality to retrieve popular words based on search parameters and manages caching for improved performance.
  • Field Details

    • CACHE_KEY_SPLITTER

      protected static final char CACHE_KEY_SPLITTER
      Character used to separate cache key components
      See Also:
    • cache

      protected com.google.common.cache.Cache<String,List<String>> cache
      Cache for storing popular word lists
    • fessConfig

      protected org.codelibs.fess.mylasta.direction.FessConfig fessConfig
      Fess configuration instance
  • Constructor Details

    • PopularWordHelper

      public PopularWordHelper()
      Default constructor.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the PopularWordHelper after dependency injection. Sets up the cache with configured size and expiration settings.
    • getWordList

      public List<String> getWordList(SearchRequestParams.SearchRequestType searchRequestType, String seed, String[] tags, String[] roles, String[] fields, String[] excludes)
      Retrieves a list of popular words based on the specified search parameters. Uses caching to improve performance for repeated requests.
      Parameters:
      searchRequestType - the type of search request
      seed - the seed value for popular word generation
      tags - array of tags to filter results
      roles - array of roles to filter results
      fields - array of fields to search in
      excludes - array of words to exclude from results
      Returns:
      list of popular words matching the criteria
    • clearCache

      public void clearCache()
      Clears all cached popular word lists.
    • getCacheKey

      protected String getCacheKey(String seed, String[] tags, String[] roles, String[] fields, String[] excludes)
      Generates a cache key based on the provided parameters.
      Parameters:
      seed - the seed value
      tags - array of tags
      roles - array of roles
      fields - array of fields
      excludes - array of excluded words
      Returns:
      cache key string