Package org.elasticsearch.search.rescore
Class QueryRescorerBuilder
- java.lang.Object
-
- org.elasticsearch.search.rescore.RescorerBuilder<QueryRescorerBuilder>
-
- org.elasticsearch.search.rescore.QueryRescorerBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentObject,Rewriteable<RescorerBuilder<QueryRescorerBuilder>>
public class QueryRescorerBuilder extends RescorerBuilder<QueryRescorerBuilder>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static floatDEFAULT_QUERYWEIGHTstatic floatDEFAULT_RESCORE_QUERYWEIGHTstatic QueryRescoreModeDEFAULT_SCORE_MODEstatic java.lang.StringNAME-
Fields inherited from class org.elasticsearch.search.rescore.RescorerBuilder
DEFAULT_WINDOW_SIZE, windowSize
-
Fields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description QueryRescorerBuilder(StreamInput in)Read from a stream.QueryRescorerBuilder(QueryBuilder builder)Creates a newQueryRescorerBuilderinstance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoWriteTo(StreamOutput out)voiddoXContent(XContentBuilder builder, ToXContent.Params params)booleanequals(java.lang.Object obj)static QueryRescorerBuilderfromXContent(XContentParser parser)floatgetQueryWeight()Gets the original query weight for rescoring.QueryBuildergetRescoreQuery()floatgetRescoreQueryWeight()Gets the original query weight for rescoring.QueryRescoreModegetScoreMode()Gets the original query score mode.java.lang.StringgetWriteableName()Returns the name of the writeable objectinthashCode()QueryRescorer.QueryRescoreContextinnerBuildContext(int windowSize, QueryShardContext context)Extensions override this to build the context that they need for rescoring.QueryRescorerBuilderrewrite(QueryRewriteContext ctx)Rewrites this instance based on the provided context.QueryRescorerBuildersetQueryWeight(float queryWeight)Sets the original query weight for rescoring.QueryRescorerBuildersetRescoreQueryWeight(float rescoreQueryWeight)Sets the original query weight for rescoring.QueryRescorerBuildersetScoreMode(QueryRescoreMode scoreMode)Sets the original query score mode.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class org.elasticsearch.search.rescore.RescorerBuilder
buildContext, parseFromXContent, toString, toXContent, windowSize, windowSize, writeTo
-
Methods inherited from interface org.elasticsearch.index.query.Rewriteable
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEFAULT_RESCORE_QUERYWEIGHT
public static final float DEFAULT_RESCORE_QUERYWEIGHT
- See Also:
- Constant Field Values
-
DEFAULT_QUERYWEIGHT
public static final float DEFAULT_QUERYWEIGHT
- See Also:
- Constant Field Values
-
DEFAULT_SCORE_MODE
public static final QueryRescoreMode DEFAULT_SCORE_MODE
-
-
Constructor Detail
-
QueryRescorerBuilder
public QueryRescorerBuilder(QueryBuilder builder)
Creates a newQueryRescorerBuilderinstance- Parameters:
builder- the query builder to build the rescore query from
-
QueryRescorerBuilder
public QueryRescorerBuilder(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
doWriteTo
public void doWriteTo(StreamOutput out) throws java.io.IOException
- Specified by:
doWriteToin classRescorerBuilder<QueryRescorerBuilder>- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()
Description copied from interface:NamedWriteableReturns the name of the writeable object
-
getRescoreQuery
public QueryBuilder getRescoreQuery()
- Returns:
- the query used for this rescore query
-
setQueryWeight
public QueryRescorerBuilder setQueryWeight(float queryWeight)
Sets the original query weight for rescoring. The default is1.0
-
getQueryWeight
public float getQueryWeight()
Gets the original query weight for rescoring. The default is1.0
-
setRescoreQueryWeight
public QueryRescorerBuilder setRescoreQueryWeight(float rescoreQueryWeight)
Sets the original query weight for rescoring. The default is1.0
-
getRescoreQueryWeight
public float getRescoreQueryWeight()
Gets the original query weight for rescoring. The default is1.0
-
setScoreMode
public QueryRescorerBuilder setScoreMode(QueryRescoreMode scoreMode)
Sets the original query score mode. The default isQueryRescoreMode.Total.
-
getScoreMode
public QueryRescoreMode getScoreMode()
Gets the original query score mode. The default istotal
-
doXContent
public void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
doXContentin classRescorerBuilder<QueryRescorerBuilder>- Throws:
java.io.IOException
-
fromXContent
public static QueryRescorerBuilder fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
innerBuildContext
public QueryRescorer.QueryRescoreContext innerBuildContext(int windowSize, QueryShardContext context) throws java.io.IOException
Description copied from class:RescorerBuilderExtensions override this to build the context that they need for rescoring.- Specified by:
innerBuildContextin classRescorerBuilder<QueryRescorerBuilder>- Throws:
java.io.IOException
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classRescorerBuilder<QueryRescorerBuilder>
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equalsin classRescorerBuilder<QueryRescorerBuilder>
-
rewrite
public QueryRescorerBuilder rewrite(QueryRewriteContext ctx) throws java.io.IOException
Description copied from interface:RewriteableRewrites this instance based on the provided context. The returned objects will be the same instance as this if no changes during the rewrite were applied.- Throws:
java.io.IOException
-
-