This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_9_0
in repository https://gitbox.apache.org/repos/asf/solr.git

commit d1f1f5465969f5e5198b91a5153a1181237d88ce
Author: Kevin Risden <[email protected]>
AuthorDate: Tue Sep 6 10:23:23 2022 -0400

    SOLR-16399: ExportWriter fails with max values for fields (#995)
---
 solr/CHANGES.txt                                                    | 3 ++-
 solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 79ec41f3437..f4417863ba9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -8,13 +8,14 @@ 
https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/upgrade-not
 
 Bug Fixes
 ---------------------
-
 * SOLR-16191: Validate that installed ps utility supports -p flag, so that we 
do not inadvertantly stop the wrong process. (Mike Drob, Michael Gibney)
 
 * SOLR-16209: Rolling restart will no longer trigger as much PKI Plugin error 
logging. (Mike Drob, Tomás Fernández Löbbe)
 
 * SOLR-16264: Set versions for all Antora build tools (Houston Putman)
 
+* SOLR-16399: ExportWriter fails with max values for fields (Kevin Risden)
+
 ==================  9.0.0 ==================
 
 New Features
diff --git 
a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java 
b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
index c943e1b3ee2..a6b8ac281c7 100644
--- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
+++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
@@ -804,7 +804,9 @@ public class ExportWriter implements SolrCore.RawWriter, 
Closeable {
         int docId;
         while ((docId = it.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
           this.sortDoc.setValues(docId);
-          if (top.lessThan(this.sortDoc)) {
+          // Always set the top doc if previously not set, otherwise
+          // set the top if the sortDoc is greater than current
+          if (top.lessThan(this.sortDoc) || top.docId == -1) {
             top.setValues(this.sortDoc);
             top = queue.updateTop();
           }

Reply via email to