From a27c35de22b21d6dcab887a74108f5dfe7906d7a Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 07:58:07 -0500 Subject: [PATCH] Fix maxScore check in reduce phase when some scores are NaN (#11267) (#11268) (cherry picked from commit 60c46f3a6c33b1c1074f161b629927e5d60917c0) Signed-off-by: Jay Deng Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../java/org/opensearch/search/sort/FieldSortIT.java | 4 ---- .../org/opensearch/search/query/TopDocsCollectorContext.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java b/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java index 3c5574f823c3b..81e948640ee94 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java @@ -268,10 +268,6 @@ public void testIssue6614() throws ExecutionException, InterruptedException { } public void testTrackScores() throws Exception { - assumeFalse( - "Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/11189", - internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING) - ); assertAcked(client().admin().indices().prepareCreate("test").setMapping("svalue", "type=keyword").get()); ensureGreen(); index( diff --git a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java index 86f6e542f97d1..65d3948c8401e 100644 --- a/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java +++ b/server/src/main/java/org/opensearch/search/query/TopDocsCollectorContext.java @@ -532,7 +532,7 @@ public ReduceableSearchResult reduce(Collection collectors) throws IO float score = collector.getMaxScore(); if (Float.isNaN(maxScore)) { maxScore = score; - } else { + } else if (!Float.isNaN(score)) { maxScore = Math.max(maxScore, score); } }