public class CommonTermsQueryBuilder extends QueryBuilder implements BoostableQueryBuilder<CommonTermsQueryBuilder>
#add(Term)
added
terms where low-frequency terms are added to a required boolean clause
and high-frequency terms are added to an optional boolean clause. The
optional clause is only executed if the required "low-frequency' clause
matches. Scores produced by this query will be slightly different to plain
BooleanQuery
scorer mainly due to differences in the
number of leave queries
in the required
boolean clause. In the most cases high-frequency terms are unlikely to
significantly contribute to the document score unless at least one of the
low-frequency terms are matched such that this query can improve query
execution times significantly if applicable.Modifier and Type | Class and Description |
---|---|
static class |
CommonTermsQueryBuilder.Operator |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor and Description |
---|
CommonTermsQueryBuilder(String name,
Object text)
Constructs a new common terms query.
|
Modifier and Type | Method and Description |
---|---|
CommonTermsQueryBuilder |
analyzer(String analyzer)
Explicitly set the analyzer to use.
|
CommonTermsQueryBuilder |
boost(float boost)
Set the boost to apply to the query.
|
CommonTermsQueryBuilder |
cutoffFrequency(float cutoffFrequency)
Sets the cutoff document frequency for high / low frequent terms.
|
CommonTermsQueryBuilder |
disableCoord(boolean disableCoord) |
void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
CommonTermsQueryBuilder |
highFreqMinimumShouldMatch(String highFreqMinimumShouldMatch)
Sets the minimum number of high frequent query terms that need to match in order to
produce a hit when there are no low frequen terms.
|
CommonTermsQueryBuilder |
highFreqOperator(CommonTermsQueryBuilder.Operator operator)
Sets the operator to use for terms with a high document frequency
(greater than or equal to
cutoffFrequency(float) . |
CommonTermsQueryBuilder |
lowFreqMinimumShouldMatch(String lowFreqMinimumShouldMatch)
Sets the minimum number of low frequent query terms that need to match in order to
produce a hit.
|
CommonTermsQueryBuilder |
lowFreqOperator(CommonTermsQueryBuilder.Operator operator)
Sets the operator to use for terms with a low document frequency (less
than
cutoffFrequency(float) . |
CommonTermsQueryBuilder |
queryName(String queryName)
Sets the query name for the filter that can be used when searching for matched_filters per hit.
|
toXContent
buildAsBytes, buildAsBytes, toString
public CommonTermsQueryBuilder highFreqOperator(CommonTermsQueryBuilder.Operator operator)
cutoffFrequency(float)
. Defaults to
AND.public CommonTermsQueryBuilder lowFreqOperator(CommonTermsQueryBuilder.Operator operator)
cutoffFrequency(float)
. Defaults to AND.public CommonTermsQueryBuilder analyzer(String analyzer)
public CommonTermsQueryBuilder boost(float boost)
boost
in interface BoostableQueryBuilder<CommonTermsQueryBuilder>
public CommonTermsQueryBuilder cutoffFrequency(float cutoffFrequency)
public CommonTermsQueryBuilder highFreqMinimumShouldMatch(String highFreqMinimumShouldMatch)
public CommonTermsQueryBuilder lowFreqMinimumShouldMatch(String lowFreqMinimumShouldMatch)
public CommonTermsQueryBuilder disableCoord(boolean disableCoord)
public CommonTermsQueryBuilder queryName(String queryName)
public void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
doXContent
in class QueryBuilder
IOException
Copyright © 2009–2017. All rights reserved.