Package de.cxp.ocs.config
Class QueryConfiguration
java.lang.Object
de.cxp.ocs.config.QueryConfiguration
Configuration that describes how a single query is constructed and under
which conditions it is used.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Describes the condition under that the particular query is constructed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetCondition
(QueryConfiguration.QueryCondition condition) Specify the search-term conditions to build the Elasticsearch query based on this configuration.Should be a unique name of that query (e.g.setSettings
(Map<QueryBuildingSetting, String> settings) Sets theQueryBuildingSetting
s for that query.setStrategy
(String strategy) Simple or canonical class name of theESQueryFactory
that is used to build that query.setWeightedFields
(Map<String, Float> weightedFields) Defines the fields to be searched and their according weight.
-
Constructor Details
-
QueryConfiguration
public QueryConfiguration()
-
-
Method Details
-
setName
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
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
Simple or canonical class name of the
Defaults to 'DefaultQueryFactory'. These ones are available:ESQueryFactory
that is used to build that query. The suffix 'Factory' is optional.- DefaultQueryFactory
- ConfigurableQueryFactory
- NgramQueryFactory
- PredictionQueryFactory
- Parameters:
strategy
- strategy name- Returns:
- self
-
setWeightedFields
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
Sets theQueryBuildingSetting
s for that query. Check the according QueryFactory to see which settings it supports.- Parameters:
settings
- strategy specific settings- Returns:
- self
-