Class KeyMatchHelper

java.lang.Object
org.codelibs.fess.helper.AbstractConfigHelper
org.codelibs.fess.helper.KeyMatchHelper

public class KeyMatchHelper extends AbstractConfigHelper
KeyMatchHelper is a helper class for KeyMatch feature. It manages KeyMatch instances and provides methods to build queries for boosting documents.
  • Field Details

    • keyMatchQueryMap

      protected volatile Map<String,Map<String,List<org.codelibs.core.misc.Tuple3<String,org.opensearch.index.query.QueryBuilder,org.opensearch.index.query.functionscore.ScoreFunctionBuilder<?>>>>> keyMatchQueryMap
      A map containing query information for KeyMatch. The key is a virtual host, and the value is a map of terms and boost information.
  • Constructor Details

    • KeyMatchHelper

      public KeyMatchHelper()
      Default constructor.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the helper. It loads KeyMatch settings from the database.
    • getAvailableKeyMatchList

      public List<org.codelibs.fess.opensearch.config.exentity.KeyMatch> getAvailableKeyMatchList()
      Returns a list of available KeyMatch instances.
      Returns:
      A list of KeyMatch instances.
    • load

      public int load()
      Loads KeyMatch settings from the database and builds a query map.
      Specified by:
      load in class AbstractConfigHelper
      Returns:
      The number of loaded KeyMatch settings.
    • getDocumentList

      protected List<Map<String,Object>> getDocumentList(org.codelibs.fess.opensearch.config.exentity.KeyMatch keyMatch)
      Retrieves a list of documents based on the KeyMatch query.
      Parameters:
      keyMatch - The KeyMatch instance.
      Returns:
      A list of documents.
    • getQueryMap

      protected Map<String,List<org.codelibs.core.misc.Tuple3<String,org.opensearch.index.query.QueryBuilder,org.opensearch.index.query.functionscore.ScoreFunctionBuilder<?>>>> getQueryMap(String key)
      Returns a query map for the specified virtual host.
      Parameters:
      key - The virtual host key.
      Returns:
      A map of terms and boost information.
    • buildQuery

      public void buildQuery(List<String> keywordList, List<org.opensearch.index.query.functionscore.FunctionScoreQueryBuilder.FilterFunctionBuilder> list)
      Builds a query for boosting documents based on the keyword list.
      Parameters:
      keywordList - The list of keywords.
      list - The list of filter function builders to add to.
    • getBoostedDocumentList

      public List<Map<String,Object>> getBoostedDocumentList(org.codelibs.fess.opensearch.config.exentity.KeyMatch keyMatch)
      Retrieves a list of boosted documents for the specified KeyMatch.
      Parameters:
      keyMatch - The KeyMatch instance.
      Returns:
      A list of boosted documents.