Package de.cxp.ocs.config
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryConfiguration.QueryConditionDescribes the condition under that the particular query is constructed.
-
Constructor Summary
Constructors Constructor Description QueryConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryConfigurationsetCondition(QueryConfiguration.QueryCondition condition)Specify the search-term conditions to build the Elasticsearch query based on this configuration.QueryConfigurationsetName(String name)Should be a unique name of that query (e.g.QueryConfigurationsetSettings(Map<QueryBuildingSetting,String> settings)Sets theQueryBuildingSettings for that query.QueryConfigurationsetStrategy(String strategy)Simple or canonical class name of theESQueryFactorythat is used to build that query.QueryConfigurationsetWeightedFields(Map<String,Float> weightedFields)Defines the fields to be searched and their according weight.
-
-
-
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
-
setCondition
public QueryConfiguration setCondition(QueryConfiguration.QueryCondition condition)
Specify the search-term conditions to build the Elasticsearch query based on this configuration.- Parameters:
condition-- Returns:
- self
-
setStrategy
public QueryConfiguration setStrategy(String strategy)
Simple or canonical class name of the
Defaults to 'DefaultQueryFactory'. These ones are available:ESQueryFactorythat is used to build that query. The suffix 'Factory' is optional.- 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
-
setSettings
public QueryConfiguration setSettings(Map<QueryBuildingSetting,String> settings)
Sets theQueryBuildingSettings for that query. Check the according QueryFactory to see which settings it supports.- Parameters:
settings-- Returns:
- self
-
-