org.elasticsearch.index.query
Class DisMaxQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.BaseQueryBuilder
      extended by org.elasticsearch.index.query.DisMaxQueryBuilder
All Implemented Interfaces:
ToXContent, BoostableQueryBuilder<DisMaxQueryBuilder>, QueryBuilder

public class DisMaxQueryBuilder
extends BaseQueryBuilder
implements BoostableQueryBuilder<DisMaxQueryBuilder>

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.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
DisMaxQueryBuilder()
           
 
Method Summary
 DisMaxQueryBuilder add(QueryBuilder queryBuilder)
          Add a sub-query to this disjunction.
 DisMaxQueryBuilder boost(float boost)
          Sets the boost for this query.
protected  void doXContent(XContentBuilder builder, ToXContent.Params params)
           
 DisMaxQueryBuilder 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.BaseQueryBuilder
buildAsBytes, buildAsBytes, toString, toXContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DisMaxQueryBuilder

public DisMaxQueryBuilder()
Method Detail

add

public DisMaxQueryBuilder add(QueryBuilder queryBuilder)
Add a sub-query to this disjunction.


boost

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

Specified by:
boost in interface BoostableQueryBuilder<DisMaxQueryBuilder>

tieBreaker

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


doXContent

protected void doXContent(XContentBuilder builder,
                          ToXContent.Params params)
                   throws IOException
Specified by:
doXContent in class BaseQueryBuilder
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.