org.elasticsearch.index.query.json
Class FieldJsonQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.json.BaseJsonQueryBuilder
      extended by org.elasticsearch.index.query.json.FieldJsonQueryBuilder
All Implemented Interfaces:
JsonQueryBuilder, QueryBuilder, ToJson

public class FieldJsonQueryBuilder
extends BaseJsonQueryBuilder

A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.


Nested Class Summary
static class FieldJsonQueryBuilder.Operator
           
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.json.ToJson
ToJson.MapParams, ToJson.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.util.json.ToJson
EMPTY_PARAMS
 
Constructor Summary
FieldJsonQueryBuilder(java.lang.String name, double query)
          A query that executes the query string against a field.
FieldJsonQueryBuilder(java.lang.String name, float query)
          A query that executes the query string against a field.
FieldJsonQueryBuilder(java.lang.String name, int query)
          A query that executes the query string against a field.
FieldJsonQueryBuilder(java.lang.String name, long query)
          A query that executes the query string against a field.
FieldJsonQueryBuilder(java.lang.String name, java.lang.String query)
          A query that executes the query string against a field.
 
Method Summary
 FieldJsonQueryBuilder allowLeadingWildcard(boolean allowLeadingWildcard)
          Should leading wildcards be allowed or not.
 FieldJsonQueryBuilder analyzer(java.lang.String analyzer)
          The optional analyzer used to analyze the query string.
 FieldJsonQueryBuilder boost(float boost)
          Sets the boost for this query.
 FieldJsonQueryBuilder defaultOperator(FieldJsonQueryBuilder.Operator defaultOperator)
          Sets the boolean operator of the query parser used to parse the query string.
 void doJson(JsonBuilder builder, ToJson.Params params)
           
 FieldJsonQueryBuilder enablePositionIncrements(boolean enablePositionIncrements)
          Set to true to enable position increments in result query.
 FieldJsonQueryBuilder fuzzyMinSim(float fuzzyMinSim)
          Set the minimum similarity for fuzzy queries.
 FieldJsonQueryBuilder fuzzyPrefixLength(int fuzzyPrefixLength)
          Set the prefix length for fuzzy queries.
 FieldJsonQueryBuilder lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
          Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not.
 FieldJsonQueryBuilder phraseSlop(int phraseSlop)
          Sets the default slop for phrases.
 
Methods inherited from class org.elasticsearch.index.query.json.BaseJsonQueryBuilder
buildAsBytes, buildAsString, buildAsUnsafeChars, toJson
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldJsonQueryBuilder

public FieldJsonQueryBuilder(java.lang.String name,
                             java.lang.String query)
A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.

Parameters:
name - The name of the field
query - The query string

FieldJsonQueryBuilder

public FieldJsonQueryBuilder(java.lang.String name,
                             int query)
A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.

Parameters:
name - The name of the field
query - The query string

FieldJsonQueryBuilder

public FieldJsonQueryBuilder(java.lang.String name,
                             long query)
A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.

Parameters:
name - The name of the field
query - The query string

FieldJsonQueryBuilder

public FieldJsonQueryBuilder(java.lang.String name,
                             float query)
A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.

Parameters:
name - The name of the field
query - The query string

FieldJsonQueryBuilder

public FieldJsonQueryBuilder(java.lang.String name,
                             double query)
A query that executes the query string against a field. It is a simplified version of QueryStringJsonQueryBuilder that simply runs against a single field.

Parameters:
name - The name of the field
query - The query string
Method Detail

boost

public FieldJsonQueryBuilder boost(float boost)
Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided.


defaultOperator

public FieldJsonQueryBuilder defaultOperator(FieldJsonQueryBuilder.Operator defaultOperator)
Sets the boolean operator of the query parser used to parse the query string.

In default mode (FieldJsonQueryBuilder.Operator.OR) terms without any modifiers are considered optional: for example capital of Hungary is equal to capital OR of OR Hungary.

In FieldJsonQueryBuilder.Operator.AND mode terms are considered to be in conjunction: the above mentioned query is parsed as capital AND of AND Hungary


analyzer

public FieldJsonQueryBuilder analyzer(java.lang.String analyzer)
The optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer.


allowLeadingWildcard

public FieldJsonQueryBuilder allowLeadingWildcard(boolean allowLeadingWildcard)
Should leading wildcards be allowed or not. Defaults to true.


lowercaseExpandedTerms

public FieldJsonQueryBuilder lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true.


enablePositionIncrements

public FieldJsonQueryBuilder enablePositionIncrements(boolean enablePositionIncrements)
Set to true to enable position increments in result query. Defaults to true.

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.


fuzzyMinSim

public FieldJsonQueryBuilder fuzzyMinSim(float fuzzyMinSim)
Set the minimum similarity for fuzzy queries. Default is 0.5f.


fuzzyPrefixLength

public FieldJsonQueryBuilder fuzzyPrefixLength(int fuzzyPrefixLength)
Set the prefix length for fuzzy queries. Default is 0.


phraseSlop

public FieldJsonQueryBuilder phraseSlop(int phraseSlop)
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.


doJson

public void doJson(JsonBuilder builder,
                   ToJson.Params params)
            throws java.io.IOException
Specified by:
doJson in class BaseJsonQueryBuilder
Throws:
java.io.IOException