mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Ensure that percolator sorting also works (#52758)
Commit #52748 fixed a bug where percolate queries wrapped in a constant score could report incorrect matches. This commit adds a test to check that it also fixes the case where a percolate query is sorted by something other than score. Closes #52618
This commit is contained in:
parent
f57422bbfd
commit
a76ec765e5
@ -967,6 +967,11 @@ public class PercolatorQuerySearchIT extends ESIntegTestCase {
|
|||||||
BytesReference.bytes(jsonBuilder().startObject().field("d", "2020-02-01T15:00:00.000+11:00").endObject()),
|
BytesReference.bytes(jsonBuilder().startObject().field("d", "2020-02-01T15:00:00.000+11:00").endObject()),
|
||||||
XContentType.JSON)).get();
|
XContentType.JSON)).get();
|
||||||
assertEquals(1, response.getHits().getTotalHits().value);
|
assertEquals(1, response.getHits().getTotalHits().value);
|
||||||
|
|
||||||
|
response = client().prepareSearch("test").setQuery(new PercolateQueryBuilder("q",
|
||||||
|
BytesReference.bytes(jsonBuilder().startObject().field("d", "2020-02-01T15:00:00.000+11:00").endObject()),
|
||||||
|
XContentType.JSON)).addSort("_doc", SortOrder.ASC).get();
|
||||||
|
assertEquals(1, response.getHits().getTotalHits().value);
|
||||||
|
|
||||||
response = client().prepareSearch("test").setQuery(constantScoreQuery(new PercolateQueryBuilder("q",
|
response = client().prepareSearch("test").setQuery(constantScoreQuery(new PercolateQueryBuilder("q",
|
||||||
BytesReference.bytes(jsonBuilder().startObject().field("d", "2020-02-01T15:00:00.000+11:00").endObject()),
|
BytesReference.bytes(jsonBuilder().startObject().field("d", "2020-02-01T15:00:00.000+11:00").endObject()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user