|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.elasticsearch.index.query.BaseQueryBuilder
org.elasticsearch.index.query.QueryStringQueryBuilder
public class QueryStringQueryBuilder
A query that parses a query string and runs it. There are two modes that this operates. The first,
when no field is added (using field(String)
, will run the query once and non prefixed fields
will use the defaultField(String)
set. The second, when one or more fields are added
(using field(String)
), will run the parsed query against the provided fields, and combine
them either using DisMax or a plain boolean query (see useDisMax(boolean)
).
Nested Class Summary | |
---|---|
static class |
QueryStringQueryBuilder.Operator
|
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
ToXContent.MapParams, ToXContent.Params |
Field Summary |
---|
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
EMPTY_PARAMS |
Constructor Summary | |
---|---|
QueryStringQueryBuilder(java.lang.String queryString)
|
Method Summary | |
---|---|
QueryStringQueryBuilder |
allowLeadingWildcard(boolean allowLeadingWildcard)
Should leading wildcards be allowed or not. |
QueryStringQueryBuilder |
analyzer(java.lang.String analyzer)
The optional analyzer used to analyze the query string. |
QueryStringQueryBuilder |
analyzeWildcard(boolean analyzeWildcard)
Set to true to enable analysis on wildcard and prefix queries. |
QueryStringQueryBuilder |
autoGeneratePhraseQueries(boolean autoGeneratePhraseQueries)
Set to true if phrase queries will be automatically generated when the analyzer returns more than one term from whitespace delimited text. |
QueryStringQueryBuilder |
boost(float boost)
Sets the boost for this query. |
QueryStringQueryBuilder |
defaultField(java.lang.String defaultField)
The default field to run against when no prefix field is specified. |
QueryStringQueryBuilder |
defaultOperator(QueryStringQueryBuilder.Operator defaultOperator)
Sets the boolean operator of the query parser used to parse the query string. |
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params)
|
QueryStringQueryBuilder |
enablePositionIncrements(boolean enablePositionIncrements)
Set to true to enable position increments in result query. |
QueryStringQueryBuilder |
field(java.lang.String field)
Adds a field to run the query string against. |
QueryStringQueryBuilder |
field(java.lang.String field,
float boost)
Adds a field to run the query string against with a specific boost. |
QueryStringQueryBuilder |
fuzzyMinSim(float fuzzyMinSim)
Set the minimum similarity for fuzzy queries. |
QueryStringQueryBuilder |
fuzzyPrefixLength(int fuzzyPrefixLength)
Set the minimum similarity for fuzzy queries. |
QueryStringQueryBuilder |
lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. |
QueryStringQueryBuilder |
minimumShouldMatch(java.lang.String minimumShouldMatch)
|
QueryStringQueryBuilder |
phraseSlop(int phraseSlop)
Sets the default slop for phrases. |
QueryStringQueryBuilder |
rewrite(java.lang.String rewrite)
|
QueryStringQueryBuilder |
tieBreaker(float tieBreaker)
When more than one field is used with the query string, and combined queries are using dis max, control the tie breaker for it. |
QueryStringQueryBuilder |
useDisMax(boolean useDisMax)
When more than one field is used with the query string, should queries be combined using dis max, or boolean query. |
Methods inherited from class org.elasticsearch.index.query.BaseQueryBuilder |
---|
buildAsBytes, buildAsBytes, buildAsUnsafeBytes, buildAsUnsafeBytes, toString, toXContent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryStringQueryBuilder(java.lang.String queryString)
Method Detail |
---|
public QueryStringQueryBuilder defaultField(java.lang.String defaultField)
public QueryStringQueryBuilder field(java.lang.String field)
public QueryStringQueryBuilder field(java.lang.String field, float boost)
public QueryStringQueryBuilder useDisMax(boolean useDisMax)
public QueryStringQueryBuilder tieBreaker(float tieBreaker)
public QueryStringQueryBuilder defaultOperator(QueryStringQueryBuilder.Operator defaultOperator)
In default mode (FieldQueryBuilder.Operator.OR
) terms without any modifiers
are considered optional: for example capital of Hungary
is equal to
capital OR of OR Hungary
.
In FieldQueryBuilder.Operator.AND
mode terms are considered to be in conjunction: the
above mentioned query is parsed as capital AND of AND Hungary
public QueryStringQueryBuilder analyzer(java.lang.String analyzer)
public QueryStringQueryBuilder autoGeneratePhraseQueries(boolean autoGeneratePhraseQueries)
Set to false if phrase queries should only be generated when surrounded by double quotes.
public QueryStringQueryBuilder allowLeadingWildcard(boolean allowLeadingWildcard)
public QueryStringQueryBuilder lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
public QueryStringQueryBuilder enablePositionIncrements(boolean enablePositionIncrements)
When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.
public QueryStringQueryBuilder fuzzyMinSim(float fuzzyMinSim)
public QueryStringQueryBuilder fuzzyPrefixLength(int fuzzyPrefixLength)
public QueryStringQueryBuilder phraseSlop(int phraseSlop)
public QueryStringQueryBuilder analyzeWildcard(boolean analyzeWildcard)
public QueryStringQueryBuilder rewrite(java.lang.String rewrite)
public QueryStringQueryBuilder minimumShouldMatch(java.lang.String minimumShouldMatch)
public QueryStringQueryBuilder boost(float boost)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
doXContent
in class BaseQueryBuilder
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |