Class QueryConfiguration


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

      • QueryConfiguration

        public QueryConfiguration()
    • Method Detail

      • 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 -
        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 -
        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 -
        Returns:
        self