org.elasticsearch.index.query.json
Class DisMaxJsonQueryBuilder

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

public class DisMaxJsonQueryBuilder
extends BaseJsonQueryBuilder

A query that generates the union of documents produced by its sub-queries, and that scores each document with the maximum score for that document as produced by any sub-query, plus a tie breaking increment for any additional matching sub-queries.


Nested Class Summary
 
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
DisMaxJsonQueryBuilder()
           
 
Method Summary
 DisMaxJsonQueryBuilder add(JsonQueryBuilder queryBuilder)
          Add a sub-query to this disjunction.
 DisMaxJsonQueryBuilder boost(float boost)
          Sets the boost for this query.
protected  void doJson(JsonBuilder builder, ToJson.Params params)
           
 DisMaxJsonQueryBuilder tieBreaker(float tieBreaker)
          The score of each non-maximum disjunct for a document is multiplied by this weight and added into the final score.
 
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

DisMaxJsonQueryBuilder

public DisMaxJsonQueryBuilder()
Method Detail

add

public DisMaxJsonQueryBuilder add(JsonQueryBuilder queryBuilder)
Add a sub-query to this disjunction.


boost

public DisMaxJsonQueryBuilder 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.


tieBreaker

public DisMaxJsonQueryBuilder tieBreaker(float tieBreaker)
The score of each non-maximum disjunct for a document is multiplied by this weight and added into the final score. If non-zero, the value should be small, on the order of 0.1, which says that 10 occurrences of word in a lower-scored field that is also in a higher scored field is just as good as a unique word in the lower scored field (i.e., one that is not in any higher scored field.


doJson

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