org.elasticsearch.index.query
Class CustomScoreQueryBuilder

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

public class CustomScoreQueryBuilder
extends BaseQueryBuilder
implements BoostableQueryBuilder<CustomScoreQueryBuilder>

A query that uses a script to compute the score.


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
CustomScoreQueryBuilder(QueryBuilder queryBuilder)
          A query that simply applies the boost factor to another query (multiply it).
 
Method Summary
 CustomScoreQueryBuilder boost(float boost)
          Sets the boost for this query.
protected  void doXContent(XContentBuilder builder, ToXContent.Params params)
           
 CustomScoreQueryBuilder lang(String lang)
          Sets the language of the script.
 CustomScoreQueryBuilder param(String key, Object value)
          Additional parameters that can be provided to the script.
 CustomScoreQueryBuilder params(Map<String,Object> params)
          Additional parameters that can be provided to the script.
 CustomScoreQueryBuilder script(String script)
          Sets the boost factor for this query.
 
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

CustomScoreQueryBuilder

public CustomScoreQueryBuilder(QueryBuilder queryBuilder)
A query that simply applies the boost factor to another query (multiply it).

Parameters:
queryBuilder - The query to apply the boost factor to.
Method Detail

script

public CustomScoreQueryBuilder script(String script)
Sets the boost factor for this query.


lang

public CustomScoreQueryBuilder lang(String lang)
Sets the language of the script.


params

public CustomScoreQueryBuilder params(Map<String,Object> params)
Additional parameters that can be provided to the script.


param

public CustomScoreQueryBuilder param(String key,
                                     Object value)
Additional parameters that can be provided to the script.


boost

public CustomScoreQueryBuilder 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<CustomScoreQueryBuilder>

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.