Class QueryConfiguration

java.lang.Object
de.cxp.ocs.config.QueryConfiguration

public class QueryConfiguration extends Object
Configuration that describes how a single query is constructed and under which conditions it is used.
  • Constructor Details

    • QueryConfiguration

      public QueryConfiguration()
  • Method Details

    • setName

      public QueryConfiguration setName(String name)
      Should be a unique name of that query (e.g. "artNrSearch", "relaxedLevel1" etc) - it will be used in the result to assign the record matches to their matching query. It can also be used to reference to other queries as "fallback query" for some query builders.
      Parameters:
      name - unique config name
      Returns:
      self
    • setCondition

      public QueryConfiguration setCondition(QueryConfiguration.QueryCondition condition)
      Specify the search-term conditions to build the Elasticsearch query based on this configuration.
      Parameters:
      condition - set condition for that query config
      Returns:
      self
    • setStrategy

      public QueryConfiguration setStrategy(String strategy)

      Simple or canonical class name of the ESQueryFactory that is used to build that query. The suffix 'Factory' is optional.

      Defaults to 'DefaultQueryFactory'. These ones are available:
      • DefaultQueryFactory
      • ConfigurableQueryFactory
      • NgramQueryFactory
      • PredictionQueryFactory
      Parameters:
      strategy - strategy name
      Returns:
      self
    • setWeightedFields

      public QueryConfiguration setWeightedFields(Map<String,Float> weightedFields)
      Defines the fields to be searched and their according weight.

      The field name may contain a wildcard at the end to match all fields with a certain prefix. Keep in mind, that this will also match all subfields with different analyzers. For example 'title*' will search in 'title', 'title.standard', 'title.shingle', and 'title.ngram' with the same weight.

      Parameters:
      weightedFields - field names with weight > 0
      Returns:
      self
    • setSettings

      public QueryConfiguration setSettings(Map<QueryBuildingSetting,String> settings)
      Sets the QueryBuildingSettings for that query. Check the according QueryFactory to see which settings it supports.
      Parameters:
      settings - strategy specific settings
      Returns:
      self