Package org.codelibs.fess.helper
Class RelatedQueryHelper
java.lang.Object
org.codelibs.fess.helper.AbstractConfigHelper
org.codelibs.fess.helper.RelatedQueryHelper
Helper class for managing related query configurations.
This class provides functionality to load, cache, and retrieve related queries
based on search terms and virtual hosts. Related queries are used to suggest
alternative or supplementary search terms to improve search results.
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap storing related queries organized by virtual host key and search term.Fields inherited from class org.codelibs.fess.helper.AbstractConfigHelper
reloadInterval -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<org.codelibs.fess.opensearch.config.exentity.RelatedQuery> Retrieves a list of all available related query entities from the data store.protected StringgetHostKey(org.codelibs.fess.opensearch.config.exentity.RelatedQuery entity) Extracts the virtual host key from a RelatedQuery entity.String[]getRelatedQueries(String query) Retrieves related queries for a given search term.voidinit()Initializes the RelatedQueryHelper after dependency injection is complete.intload()Load the configuration.Methods inherited from class org.codelibs.fess.helper.AbstractConfigHelper
setReloadInterval, update, waitForNext
-
Field Details
-
Constructor Details
-
RelatedQueryHelper
public RelatedQueryHelper()Default constructor for RelatedQueryHelper. Initializes the helper with an empty related query map.
-
-
Method Details
-
init
@PostConstruct public void init()Initializes the RelatedQueryHelper after dependency injection is complete. This method is called automatically by the dependency injection framework and loads the initial related query configurations. -
getAvailableRelatedQueryList
public List<org.codelibs.fess.opensearch.config.exentity.RelatedQuery> getAvailableRelatedQueryList()Retrieves a list of all available related query entities from the data store. The results are ordered by term and limited by the configured maximum fetch size.- Returns:
- a list of RelatedQuery entities containing all available related queries
-
load
public int load()Description copied from class:AbstractConfigHelperLoad the configuration.- Specified by:
loadin classAbstractConfigHelper- Returns:
- The number of loaded configurations.
-
getHostKey
Extracts the virtual host key from a RelatedQuery entity. If the virtual host is blank or null, returns an empty string.- Parameters:
entity- the RelatedQuery entity to extract the host key from- Returns:
- the virtual host key, or empty string if blank or null
-
getRelatedQueries
Retrieves related queries for a given search term. The search is performed using the current virtual host context and the query term is converted to lowercase for case-insensitive matching.- Parameters:
query- the search term to find related queries for- Returns:
- an array of related query strings, or empty array if none found
-