QueryRescorer should keep the window size when rewriting (#36836)
This attribute being controlled by the parent class it's easy to miss it during rewrites.
This commit is contained in:
parent
5185d61ad1
commit
3412627efe
|
@ -250,6 +250,9 @@ public class QueryRescorerBuilder extends RescorerBuilder<QueryRescorerBuilder>
|
|||
queryRescoreBuilder.setQueryWeight(queryWeight);
|
||||
queryRescoreBuilder.setRescoreQueryWeight(rescoreQueryWeight);
|
||||
queryRescoreBuilder.setScoreMode(scoreMode);
|
||||
if (windowSize() != null) {
|
||||
queryRescoreBuilder.windowSize(windowSize());
|
||||
}
|
||||
return queryRescoreBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,11 +200,13 @@ public class QueryRescorerBuilderTests extends ESTestCase {
|
|||
rescoreBuilder.setQueryWeight(randomFloat());
|
||||
rescoreBuilder.setRescoreQueryWeight(randomFloat());
|
||||
rescoreBuilder.setScoreMode(QueryRescoreMode.Max);
|
||||
rescoreBuilder.windowSize(randomIntBetween(0, 100));
|
||||
|
||||
QueryRescorerBuilder rescoreRewritten = rescoreBuilder.rewrite(mockShardContext);
|
||||
assertEquals(rescoreRewritten.getQueryWeight(), rescoreBuilder.getQueryWeight(), 0.01f);
|
||||
assertEquals(rescoreRewritten.getRescoreQueryWeight(), rescoreBuilder.getRescoreQueryWeight(), 0.01f);
|
||||
assertEquals(rescoreRewritten.getScoreMode(), rescoreBuilder.getScoreMode());
|
||||
assertEquals(rescoreRewritten.windowSize(), rescoreBuilder.windowSize());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue