Package org.codelibs.fess.helper
Class PopularWordHelper
java.lang.Object
org.codelibs.fess.helper.PopularWordHelper
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 Summary
FieldsModifier and TypeFieldDescriptionCache for storing popular word listsprotected static final charCharacter used to separate cache key componentsprotected org.codelibs.fess.mylasta.direction.FessConfigFess configuration instance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all cached popular word lists.protected StringGenerates a cache key based on the provided parameters.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.voidinit()Initializes the PopularWordHelper after dependency injection.
-
Field Details
-
CACHE_KEY_SPLITTER
protected static final char CACHE_KEY_SPLITTERCharacter used to separate cache key components- See Also:
-
cache
Cache for storing popular word lists -
fessConfig
protected org.codelibs.fess.mylasta.direction.FessConfig fessConfigFess 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 requestseed- the seed value for popular word generationtags- array of tags to filter resultsroles- array of roles to filter resultsfields- array of fields to search inexcludes- 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 valuetags- array of tagsroles- array of rolesfields- array of fieldsexcludes- array of excluded words- Returns:
- cache key string
-