Remove RescoreBuilder interface, rename AbstractRescoreBuilder to RescoreBuilder
This commit is contained in:
parent
1bc0f7a8d0
commit
664da3fa66
|
@ -46,7 +46,7 @@ import org.elasticsearch.search.fetch.innerhits.InnerHitsBuilder;
|
||||||
import org.elasticsearch.search.fetch.source.FetchSourceContext;
|
import org.elasticsearch.search.fetch.source.FetchSourceContext;
|
||||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||||
import org.elasticsearch.search.internal.SearchContext;
|
import org.elasticsearch.search.internal.SearchContext;
|
||||||
import org.elasticsearch.search.rescore.AbstractRescoreBuilder;
|
import org.elasticsearch.search.rescore.RescoreBuilder;
|
||||||
import org.elasticsearch.search.rescore.RescoreBuilder;
|
import org.elasticsearch.search.rescore.RescoreBuilder;
|
||||||
import org.elasticsearch.search.sort.SortBuilder;
|
import org.elasticsearch.search.sort.SortBuilder;
|
||||||
import org.elasticsearch.search.sort.SortBuilders;
|
import org.elasticsearch.search.sort.SortBuilders;
|
||||||
|
@ -874,7 +874,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
} else if (context.parseFieldMatcher().match(currentFieldName, RESCORE_FIELD)) {
|
} else if (context.parseFieldMatcher().match(currentFieldName, RESCORE_FIELD)) {
|
||||||
List<RescoreBuilder<?>> rescoreBuilders = new ArrayList<>();
|
List<RescoreBuilder<?>> rescoreBuilders = new ArrayList<>();
|
||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||||
rescoreBuilders.add(AbstractRescoreBuilder.parseFromXContent(context));
|
rescoreBuilders.add(RescoreBuilder.parseFromXContent(context));
|
||||||
}
|
}
|
||||||
builder.rescoreBuilders = rescoreBuilders;
|
builder.rescoreBuilders = rescoreBuilders;
|
||||||
} else if (context.parseFieldMatcher().match(currentFieldName, STATS_FIELD)) {
|
} else if (context.parseFieldMatcher().match(currentFieldName, STATS_FIELD)) {
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.elasticsearch.search.rescore;
|
|
||||||
|
|
||||||
import org.elasticsearch.ExceptionsHelper;
|
|
||||||
import org.elasticsearch.common.ParseField;
|
|
||||||
import org.elasticsearch.common.ParsingException;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The abstract base builder for instances of {@link RescoreBuilder}.
|
|
||||||
*/
|
|
||||||
public abstract class AbstractRescoreBuilder<RB extends AbstractRescoreBuilder<RB>> implements RescoreBuilder<RB> {
|
|
||||||
|
|
||||||
protected Integer windowSize;
|
|
||||||
|
|
||||||
private static ParseField WINDOW_SIZE_FIELD = new ParseField("window_size");
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public RB windowSize(int windowSize) {
|
|
||||||
this.windowSize = windowSize;
|
|
||||||
return (RB) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer windowSize() {
|
|
||||||
return windowSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RescoreBuilder<?> parseFromXContent(QueryParseContext parseContext) throws IOException {
|
|
||||||
XContentParser parser = parseContext.parser();
|
|
||||||
String fieldName = null;
|
|
||||||
AbstractRescoreBuilder<?> rescorer = null;
|
|
||||||
Integer windowSize = null;
|
|
||||||
XContentParser.Token token;
|
|
||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
|
||||||
if (token == XContentParser.Token.FIELD_NAME) {
|
|
||||||
fieldName = parser.currentName();
|
|
||||||
} else if (token.isValue()) {
|
|
||||||
if (parseContext.parseFieldMatcher().match(fieldName, WINDOW_SIZE_FIELD)) {
|
|
||||||
windowSize = parser.intValue();
|
|
||||||
} else {
|
|
||||||
throw new ParsingException(parser.getTokenLocation(), "rescore doesn't support [" + fieldName + "]");
|
|
||||||
}
|
|
||||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
|
||||||
// we only have QueryRescorer at this point
|
|
||||||
if (QueryRescorerBuilder.NAME.equals(fieldName)) {
|
|
||||||
rescorer = QueryRescorerBuilder.PROTOTYPE.fromXContent(parseContext);
|
|
||||||
} else {
|
|
||||||
throw new ParsingException(parser.getTokenLocation(), "rescore doesn't support rescorer with name [" + fieldName + "]");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ParsingException(parser.getTokenLocation(), "unexpected token [" + token + "] after [" + fieldName + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rescorer == null) {
|
|
||||||
throw new ParsingException(parser.getTokenLocation(), "missing rescore type");
|
|
||||||
}
|
|
||||||
if (windowSize != null) {
|
|
||||||
rescorer.windowSize(windowSize.intValue());
|
|
||||||
}
|
|
||||||
return rescorer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
|
||||||
builder.startObject();
|
|
||||||
if (windowSize != null) {
|
|
||||||
builder.field("window_size", windowSize);
|
|
||||||
}
|
|
||||||
doXContent(builder, params);
|
|
||||||
builder.endObject();
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void doXContent(XContentBuilder builder, Params params) throws IOException;
|
|
||||||
|
|
||||||
public static QueryRescorerBuilder queryRescorer(QueryBuilder<?> queryBuilder) {
|
|
||||||
return new QueryRescorerBuilder(queryBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(windowSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null || getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
AbstractRescoreBuilder other = (AbstractRescoreBuilder) obj;
|
|
||||||
return Objects.equals(windowSize, other.windowSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RB readFrom(StreamInput in) throws IOException {
|
|
||||||
RB builder = doReadFrom(in);
|
|
||||||
builder.windowSize = in.readOptionalVInt();
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract RB doReadFrom(StreamInput in) throws IOException;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
doWriteTo(out);
|
|
||||||
out.writeOptionalVInt(this.windowSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void doWriteTo(StreamOutput out) throws IOException;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final String toString() {
|
|
||||||
try {
|
|
||||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
|
||||||
builder.prettyPrint();
|
|
||||||
toXContent(builder, EMPTY_PARAMS);
|
|
||||||
return builder.string();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return "{ \"error\" : \"" + ExceptionsHelper.detailedMessage(e) + "\"}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -35,7 +35,7 @@ import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class QueryRescorerBuilder extends AbstractRescoreBuilder<QueryRescorerBuilder> {
|
public class QueryRescorerBuilder extends RescoreBuilder<QueryRescorerBuilder> {
|
||||||
|
|
||||||
public static final String NAME = "query";
|
public static final String NAME = "query";
|
||||||
|
|
||||||
|
@ -140,7 +140,6 @@ public class QueryRescorerBuilder extends AbstractRescoreBuilder<QueryRescorerBu
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryRescorerBuilder fromXContent(QueryParseContext parseContext) throws IOException {
|
public QueryRescorerBuilder fromXContent(QueryParseContext parseContext) throws IOException {
|
||||||
InnerBuilder innerBuilder = QUERY_RESCORE_PARSER.parse(parseContext.parser(), new InnerBuilder(), parseContext);
|
InnerBuilder innerBuilder = QUERY_RESCORE_PARSER.parse(parseContext.parser(), new InnerBuilder(), parseContext);
|
||||||
return innerBuilder.build();
|
return innerBuilder.build();
|
||||||
|
|
|
@ -19,20 +19,141 @@
|
||||||
|
|
||||||
package org.elasticsearch.search.rescore;
|
package org.elasticsearch.search.rescore;
|
||||||
|
|
||||||
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
|
import org.elasticsearch.common.ParseField;
|
||||||
|
import org.elasticsearch.common.ParsingException;
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteable;
|
import org.elasticsearch.common.io.stream.NamedWriteable;
|
||||||
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
import org.elasticsearch.index.query.QueryParseContext;
|
||||||
import org.elasticsearch.index.query.QueryShardContext;
|
import org.elasticsearch.index.query.QueryShardContext;
|
||||||
|
import org.elasticsearch.search.rescore.QueryRescorer.QueryRescoreContext;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public interface RescoreBuilder<RB extends RescoreBuilder<?>> extends ToXContent, NamedWriteable<RB> {
|
/**
|
||||||
|
* The abstract base builder for instances of {@link RescoreBuilder}.
|
||||||
|
*/
|
||||||
|
public abstract class RescoreBuilder<RB extends RescoreBuilder<RB>> implements ToXContent, NamedWriteable<RB> {
|
||||||
|
|
||||||
RescoreSearchContext build(QueryShardContext context) throws IOException;
|
protected Integer windowSize;
|
||||||
|
|
||||||
RB fromXContent(QueryParseContext parseContext) throws IOException;
|
private static ParseField WINDOW_SIZE_FIELD = new ParseField("window_size");
|
||||||
|
|
||||||
RB windowSize(int windowSize);
|
@SuppressWarnings("unchecked")
|
||||||
|
public RB windowSize(int windowSize) {
|
||||||
|
this.windowSize = windowSize;
|
||||||
|
return (RB) this;
|
||||||
|
}
|
||||||
|
|
||||||
Integer windowSize();
|
public Integer windowSize() {
|
||||||
}
|
return windowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RescoreBuilder<?> parseFromXContent(QueryParseContext parseContext) throws IOException {
|
||||||
|
XContentParser parser = parseContext.parser();
|
||||||
|
String fieldName = null;
|
||||||
|
RescoreBuilder<?> rescorer = null;
|
||||||
|
Integer windowSize = null;
|
||||||
|
XContentParser.Token token;
|
||||||
|
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||||
|
if (token == XContentParser.Token.FIELD_NAME) {
|
||||||
|
fieldName = parser.currentName();
|
||||||
|
} else if (token.isValue()) {
|
||||||
|
if (parseContext.parseFieldMatcher().match(fieldName, WINDOW_SIZE_FIELD)) {
|
||||||
|
windowSize = parser.intValue();
|
||||||
|
} else {
|
||||||
|
throw new ParsingException(parser.getTokenLocation(), "rescore doesn't support [" + fieldName + "]");
|
||||||
|
}
|
||||||
|
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||||
|
// we only have QueryRescorer at this point
|
||||||
|
if (QueryRescorerBuilder.NAME.equals(fieldName)) {
|
||||||
|
rescorer = QueryRescorerBuilder.PROTOTYPE.fromXContent(parseContext);
|
||||||
|
} else {
|
||||||
|
throw new ParsingException(parser.getTokenLocation(), "rescore doesn't support rescorer with name [" + fieldName + "]");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ParsingException(parser.getTokenLocation(), "unexpected token [" + token + "] after [" + fieldName + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rescorer == null) {
|
||||||
|
throw new ParsingException(parser.getTokenLocation(), "missing rescore type");
|
||||||
|
}
|
||||||
|
if (windowSize != null) {
|
||||||
|
rescorer.windowSize(windowSize.intValue());
|
||||||
|
}
|
||||||
|
return rescorer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
|
builder.startObject();
|
||||||
|
if (windowSize != null) {
|
||||||
|
builder.field("window_size", windowSize);
|
||||||
|
}
|
||||||
|
doXContent(builder, params);
|
||||||
|
builder.endObject();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void doXContent(XContentBuilder builder, Params params) throws IOException;
|
||||||
|
|
||||||
|
public abstract QueryRescoreContext build(QueryShardContext context) throws IOException;
|
||||||
|
|
||||||
|
public static QueryRescorerBuilder queryRescorer(QueryBuilder<?> queryBuilder) {
|
||||||
|
return new QueryRescorerBuilder(queryBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(windowSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
RescoreBuilder other = (RescoreBuilder) obj;
|
||||||
|
return Objects.equals(windowSize, other.windowSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RB readFrom(StreamInput in) throws IOException {
|
||||||
|
RB builder = doReadFrom(in);
|
||||||
|
builder.windowSize = in.readOptionalVInt();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract RB doReadFrom(StreamInput in) throws IOException;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
doWriteTo(out);
|
||||||
|
out.writeOptionalVInt(this.windowSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void doWriteTo(StreamOutput out) throws IOException;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
try {
|
||||||
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||||
|
builder.prettyPrint();
|
||||||
|
toXContent(builder, EMPTY_PARAMS);
|
||||||
|
return builder.string();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "{ \"error\" : \"" + ExceptionsHelper.detailedMessage(e) + "\"}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
|
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.SearchHits;
|
import org.elasticsearch.search.SearchHits;
|
||||||
import org.elasticsearch.search.rescore.AbstractRescoreBuilder;
|
import org.elasticsearch.search.rescore.RescoreBuilder;
|
||||||
import org.elasticsearch.search.rescore.QueryRescoreMode;
|
import org.elasticsearch.search.rescore.QueryRescoreMode;
|
||||||
import org.elasticsearch.search.rescore.QueryRescorerBuilder;
|
import org.elasticsearch.search.rescore.QueryRescorerBuilder;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
@ -80,7 +80,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
for (int j = 0 ; j < iters; j++) {
|
for (int j = 0 ; j < iters; j++) {
|
||||||
SearchResponse searchResponse = client().prepareSearch()
|
SearchResponse searchResponse = client().prepareSearch()
|
||||||
.setQuery(QueryBuilders.matchAllQuery())
|
.setQuery(QueryBuilders.matchAllQuery())
|
||||||
.setRescorer(AbstractRescoreBuilder.queryRescorer(
|
.setRescorer(RescoreBuilder.queryRescorer(
|
||||||
QueryBuilders.functionScoreQuery(QueryBuilders.matchAllQuery(),
|
QueryBuilders.functionScoreQuery(QueryBuilders.matchAllQuery(),
|
||||||
ScoreFunctionBuilders.weightFactorFunction(100)).boostMode(CombineFunction.REPLACE))
|
ScoreFunctionBuilders.weightFactorFunction(100)).boostMode(CombineFunction.REPLACE))
|
||||||
.setQueryWeight(0.0f).setRescoreQueryWeight(1.0f), 1).setSize(randomIntBetween(2, 10)).execute()
|
.setQueryWeight(0.0f).setRescoreQueryWeight(1.0f), 1).setSize(randomIntBetween(2, 10)).execute()
|
||||||
|
@ -116,7 +116,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
SearchResponse searchResponse = client().prepareSearch()
|
SearchResponse searchResponse = client().prepareSearch()
|
||||||
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "quick brown").slop(2).boost(4.0f))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "quick brown").slop(2).boost(4.0f))
|
||||||
.setRescoreQueryWeight(2), 5).execute().actionGet();
|
.setRescoreQueryWeight(2), 5).execute().actionGet();
|
||||||
|
|
||||||
assertThat(searchResponse.getHits().totalHits(), equalTo(3l));
|
assertThat(searchResponse.getHits().totalHits(), equalTo(3l));
|
||||||
|
@ -126,7 +126,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
|
|
||||||
searchResponse = client().prepareSearch()
|
searchResponse = client().prepareSearch()
|
||||||
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
||||||
.setRescorer(AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "the quick brown").slop(3)), 5)
|
.setRescorer(RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "the quick brown").slop(3)), 5)
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
|
|
||||||
assertHitCount(searchResponse, 3);
|
assertHitCount(searchResponse, 3);
|
||||||
|
@ -136,7 +136,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
|
|
||||||
searchResponse = client().prepareSearch()
|
searchResponse = client().prepareSearch()
|
||||||
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
||||||
.setRescorer(AbstractRescoreBuilder.queryRescorer((QueryBuilders.matchPhraseQuery("field1", "the quick brown"))), 5).execute()
|
.setRescorer(RescoreBuilder.queryRescorer((QueryBuilders.matchPhraseQuery("field1", "the quick brown"))), 5).execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
|
|
||||||
assertHitCount(searchResponse, 3);
|
assertHitCount(searchResponse, 3);
|
||||||
|
@ -181,7 +181,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
||||||
|
|
||||||
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
||||||
|
@ -197,7 +197,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
||||||
|
|
||||||
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
||||||
|
@ -214,7 +214,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 20).execute().actionGet();
|
||||||
|
|
||||||
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
assertThat(searchResponse.getHits().hits().length, equalTo(5));
|
||||||
|
@ -263,7 +263,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 2).execute().actionGet();
|
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 2).execute().actionGet();
|
||||||
// Only top 2 hits were re-ordered:
|
// Only top 2 hits were re-ordered:
|
||||||
assertThat(searchResponse.getHits().hits().length, equalTo(4));
|
assertThat(searchResponse.getHits().hits().length, equalTo(4));
|
||||||
|
@ -280,7 +280,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 3).execute().actionGet();
|
.setQueryWeight(0.6f).setRescoreQueryWeight(2.0f), 3).execute().actionGet();
|
||||||
|
|
||||||
// Only top 3 hits were re-ordered:
|
// Only top 3 hits were re-ordered:
|
||||||
|
@ -333,7 +333,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(5)
|
.setSize(5)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "lexington avenue massachusetts").slop(3))
|
||||||
.setQueryWeight(1.0f).setRescoreQueryWeight(-1f), 3).execute().actionGet();
|
.setQueryWeight(1.0f).setRescoreQueryWeight(-1f), 3).execute().actionGet();
|
||||||
|
|
||||||
// 6 and 1 got worse, and then the hit (2) outside the rescore window were sorted ahead:
|
// 6 and 1 got worse, and then the hit (2) outside the rescore window were sorted ahead:
|
||||||
|
@ -424,7 +424,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(resultSize)
|
.setSize(resultSize)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder
|
RescoreBuilder
|
||||||
.queryRescorer(
|
.queryRescorer(
|
||||||
QueryBuilders
|
QueryBuilders
|
||||||
.constantScoreQuery(QueryBuilders.matchPhraseQuery("field1", intToEnglish).slop(3)))
|
.constantScoreQuery(QueryBuilders.matchPhraseQuery("field1", intToEnglish).slop(3)))
|
||||||
|
@ -462,7 +462,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(resultSize)
|
.setSize(resultSize)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder
|
RescoreBuilder
|
||||||
.queryRescorer(
|
.queryRescorer(
|
||||||
QueryBuilders
|
QueryBuilders
|
||||||
.constantScoreQuery(QueryBuilders.matchPhraseQuery("field1", "not in the index").slop(3)))
|
.constantScoreQuery(QueryBuilders.matchPhraseQuery("field1", "not in the index").slop(3)))
|
||||||
|
@ -480,7 +480,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setFrom(0)
|
.setFrom(0)
|
||||||
.setSize(resultSize)
|
.setSize(resultSize)
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder
|
RescoreBuilder
|
||||||
.queryRescorer(
|
.queryRescorer(
|
||||||
QueryBuilders.matchPhraseQuery("field1", intToEnglish).slop(0))
|
QueryBuilders.matchPhraseQuery("field1", intToEnglish).slop(0))
|
||||||
.setQueryWeight(1.0f).setRescoreQueryWeight(1.0f), 2 * rescoreWindow).execute().actionGet();
|
.setQueryWeight(1.0f).setRescoreQueryWeight(1.0f), 2 * rescoreWindow).execute().actionGet();
|
||||||
|
@ -512,7 +512,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||||
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
.setQuery(QueryBuilders.matchQuery("field1", "the quick brown").operator(Operator.OR))
|
||||||
.setRescorer(
|
.setRescorer(
|
||||||
AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "the quick brown").slop(2).boost(4.0f))
|
RescoreBuilder.queryRescorer(QueryBuilders.matchPhraseQuery("field1", "the quick brown").slop(2).boost(4.0f))
|
||||||
.setQueryWeight(0.5f).setRescoreQueryWeight(0.4f), 5).setExplain(true).execute()
|
.setQueryWeight(0.5f).setRescoreQueryWeight(0.4f), 5).setExplain(true).execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
assertHitCount(searchResponse, 3);
|
assertHitCount(searchResponse, 3);
|
||||||
|
@ -538,7 +538,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
String[] scoreModes = new String[]{ "max", "min", "avg", "total", "multiply", "" };
|
String[] scoreModes = new String[]{ "max", "min", "avg", "total", "multiply", "" };
|
||||||
String[] descriptionModes = new String[]{ "max of:", "min of:", "avg of:", "sum of:", "product of:", "sum of:" };
|
String[] descriptionModes = new String[]{ "max of:", "min of:", "avg of:", "sum of:", "product of:", "sum of:" };
|
||||||
for (int innerMode = 0; innerMode < scoreModes.length; innerMode++) {
|
for (int innerMode = 0; innerMode < scoreModes.length; innerMode++) {
|
||||||
QueryRescorerBuilder innerRescoreQuery = AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchQuery("field1", "the quick brown").boost(4.0f))
|
QueryRescorerBuilder innerRescoreQuery = RescoreBuilder.queryRescorer(QueryBuilders.matchQuery("field1", "the quick brown").boost(4.0f))
|
||||||
.setQueryWeight(0.5f).setRescoreQueryWeight(0.4f);
|
.setQueryWeight(0.5f).setRescoreQueryWeight(0.4f);
|
||||||
|
|
||||||
if (!"".equals(scoreModes[innerMode])) {
|
if (!"".equals(scoreModes[innerMode])) {
|
||||||
|
@ -561,7 +561,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int outerMode = 0; outerMode < scoreModes.length; outerMode++) {
|
for (int outerMode = 0; outerMode < scoreModes.length; outerMode++) {
|
||||||
QueryRescorerBuilder outerRescoreQuery = AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchQuery("field1", "the quick brown")
|
QueryRescorerBuilder outerRescoreQuery = RescoreBuilder.queryRescorer(QueryBuilders.matchQuery("field1", "the quick brown")
|
||||||
.boost(4.0f)).setQueryWeight(0.5f).setRescoreQueryWeight(0.4f);
|
.boost(4.0f)).setQueryWeight(0.5f).setRescoreQueryWeight(0.4f);
|
||||||
|
|
||||||
if (!"".equals(scoreModes[outerMode])) {
|
if (!"".equals(scoreModes[outerMode])) {
|
||||||
|
@ -599,7 +599,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
for (int i = 0; i < numDocs - 4; i++) {
|
for (int i = 0; i < numDocs - 4; i++) {
|
||||||
String[] intToEnglish = new String[] { English.intToEnglish(i), English.intToEnglish(i + 1), English.intToEnglish(i + 2), English.intToEnglish(i + 3) };
|
String[] intToEnglish = new String[] { English.intToEnglish(i), English.intToEnglish(i + 1), English.intToEnglish(i + 2), English.intToEnglish(i + 3) };
|
||||||
|
|
||||||
QueryRescorerBuilder rescoreQuery = AbstractRescoreBuilder
|
QueryRescorerBuilder rescoreQuery = RescoreBuilder
|
||||||
.queryRescorer(
|
.queryRescorer(
|
||||||
QueryBuilders.boolQuery()
|
QueryBuilders.boolQuery()
|
||||||
.disableCoord(true)
|
.disableCoord(true)
|
||||||
|
@ -682,10 +682,10 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testMultipleRescores() throws Exception {
|
public void testMultipleRescores() throws Exception {
|
||||||
int numDocs = indexRandomNumbers("keyword", 1, true);
|
int numDocs = indexRandomNumbers("keyword", 1, true);
|
||||||
QueryRescorerBuilder eightIsGreat = AbstractRescoreBuilder.queryRescorer(
|
QueryRescorerBuilder eightIsGreat = RescoreBuilder.queryRescorer(
|
||||||
QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(8)),
|
QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(8)),
|
||||||
ScoreFunctionBuilders.weightFactorFunction(1000.0f)).boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
ScoreFunctionBuilders.weightFactorFunction(1000.0f)).boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
||||||
QueryRescorerBuilder sevenIsBetter = AbstractRescoreBuilder.queryRescorer(
|
QueryRescorerBuilder sevenIsBetter = RescoreBuilder.queryRescorer(
|
||||||
QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(7)),
|
QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(7)),
|
||||||
ScoreFunctionBuilders.weightFactorFunction(10000.0f)).boostMode(CombineFunction.REPLACE))
|
ScoreFunctionBuilders.weightFactorFunction(10000.0f)).boostMode(CombineFunction.REPLACE))
|
||||||
.setScoreMode(QueryRescoreMode.Total);
|
.setScoreMode(QueryRescoreMode.Total);
|
||||||
|
@ -703,10 +703,10 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
// We have no idea what the second hit will be because we didn't get a chance to look for seven
|
// We have no idea what the second hit will be because we didn't get a chance to look for seven
|
||||||
|
|
||||||
// Now use one rescore to drag the number we're looking for into the window of another
|
// Now use one rescore to drag the number we're looking for into the window of another
|
||||||
QueryRescorerBuilder ninetyIsGood = AbstractRescoreBuilder.queryRescorer(
|
QueryRescorerBuilder ninetyIsGood = RescoreBuilder.queryRescorer(
|
||||||
QueryBuilders.functionScoreQuery(QueryBuilders.queryStringQuery("*ninety*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
|
QueryBuilders.functionScoreQuery(QueryBuilders.queryStringQuery("*ninety*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
|
||||||
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
||||||
QueryRescorerBuilder oneToo = AbstractRescoreBuilder.queryRescorer(
|
QueryRescorerBuilder oneToo = RescoreBuilder.queryRescorer(
|
||||||
QueryBuilders.functionScoreQuery(QueryBuilders.queryStringQuery("*one*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
|
QueryBuilders.functionScoreQuery(QueryBuilders.queryStringQuery("*one*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
|
||||||
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
|
||||||
request.clearRescorers().addRescorer(ninetyIsGood, numDocs).addRescorer(oneToo, 10);
|
request.clearRescorers().addRescorer(ninetyIsGood, numDocs).addRescorer(oneToo, 10);
|
||||||
|
@ -759,7 +759,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
request.setQuery(QueryBuilders.termQuery("text", "hello"));
|
request.setQuery(QueryBuilders.termQuery("text", "hello"));
|
||||||
request.setFrom(1);
|
request.setFrom(1);
|
||||||
request.setSize(4);
|
request.setSize(4);
|
||||||
request.addRescorer(AbstractRescoreBuilder.queryRescorer(QueryBuilders.matchAllQuery()), 50);
|
request.addRescorer(RescoreBuilder.queryRescorer(QueryBuilders.matchAllQuery()), 50);
|
||||||
|
|
||||||
assertEquals(4, request.get().getHits().hits().length);
|
assertEquals(4, request.get().getHits().hits().length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
XContentParser parser = createParser(rescoreBuilder);
|
XContentParser parser = createParser(rescoreBuilder);
|
||||||
context.reset(parser);
|
context.reset(parser);
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
RescoreBuilder<?> secondRescoreBuilder = AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder<?> secondRescoreBuilder = RescoreBuilder.parseFromXContent(context);
|
||||||
assertNotSame(rescoreBuilder, secondRescoreBuilder);
|
assertNotSame(rescoreBuilder, secondRescoreBuilder);
|
||||||
assertEquals(rescoreBuilder, secondRescoreBuilder);
|
assertEquals(rescoreBuilder, secondRescoreBuilder);
|
||||||
assertEquals(rescoreBuilder.hashCode(), secondRescoreBuilder.hashCode());
|
assertEquals(rescoreBuilder.hashCode(), secondRescoreBuilder.hashCode());
|
||||||
|
@ -198,7 +198,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
"}\n";
|
"}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (ParsingException e) {
|
} catch (ParsingException e) {
|
||||||
assertEquals("rescore doesn't support rescorer with name [bad_rescorer_name]", e.getMessage());
|
assertEquals("rescore doesn't support rescorer with name [bad_rescorer_name]", e.getMessage());
|
||||||
|
@ -209,7 +209,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
"}\n";
|
"}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (ParsingException e) {
|
} catch (ParsingException e) {
|
||||||
assertEquals("rescore doesn't support [bad_fieldName]", e.getMessage());
|
assertEquals("rescore doesn't support [bad_fieldName]", e.getMessage());
|
||||||
|
@ -221,7 +221,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
"}\n";
|
"}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (ParsingException e) {
|
} catch (ParsingException e) {
|
||||||
assertEquals("unexpected token [START_ARRAY] after [query]", e.getMessage());
|
assertEquals("unexpected token [START_ARRAY] after [query]", e.getMessage());
|
||||||
|
@ -230,7 +230,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
rescoreElement = "{ }";
|
rescoreElement = "{ }";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (ParsingException e) {
|
} catch (ParsingException e) {
|
||||||
assertEquals("missing rescore type", e.getMessage());
|
assertEquals("missing rescore type", e.getMessage());
|
||||||
|
@ -242,7 +242,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
"}\n";
|
"}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertEquals("[query] unknown field [bad_fieldname], parser not found", e.getMessage());
|
assertEquals("[query] unknown field [bad_fieldname], parser not found", e.getMessage());
|
||||||
|
@ -254,7 +254,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
"}\n";
|
"}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
try {
|
try {
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
fail("expected a parsing exception");
|
fail("expected a parsing exception");
|
||||||
} catch (ParsingException e) {
|
} catch (ParsingException e) {
|
||||||
assertEquals("[query] failed to parse field [rescore_query]", e.getMessage());
|
assertEquals("[query] failed to parse field [rescore_query]", e.getMessage());
|
||||||
|
@ -265,7 +265,7 @@ public class QueryRescoreBuilderTests extends ESTestCase {
|
||||||
" \"query\" : { \"rescore_query\" : { \"match_all\" : { } } } \n"
|
" \"query\" : { \"rescore_query\" : { \"match_all\" : { } } } \n"
|
||||||
+ "}\n";
|
+ "}\n";
|
||||||
prepareContext(context, rescoreElement);
|
prepareContext(context, rescoreElement);
|
||||||
AbstractRescoreBuilder.parseFromXContent(context);
|
RescoreBuilder.parseFromXContent(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue