sigram commented on a change in pull request #1506: URL: https://github.com/apache/lucene-solr/pull/1506#discussion_r429849300
########## File path: solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java ########## @@ -285,22 +484,48 @@ protected void addDocsToItemWriter(List<LeafReaderContext> leaves, IteratorWrite protected void writeDocs(SolrQueryRequest req, IteratorWriter.ItemWriter writer, Sort sort) throws IOException { List<LeafReaderContext> leaves = req.getSearcher().getTopReaderContext().leaves(); SortDoc sortDoc = getSortDoc(req.getSearcher(), sort.getSort()); - int count = 0; final int queueSize = Math.min(DOCUMENT_BATCH_SIZE, totalHits); SortQueue queue = new SortQueue(queueSize, sortDoc); SortDoc[] outDocs = new SortDoc[queueSize]; - while (count < totalHits) { - identifyLowestSortingUnexportedDocs(leaves, sortDoc, queue); - int outDocsIndex = transferBatchToArrayForOutput(queue, outDocs); - - count += (outDocsIndex + 1); - addDocsToItemWriter(leaves, writer, outDocs, outDocsIndex); + if (streamExpression != null) { + streamContext.put(SORT_DOCS_KEY, outDocs); + streamContext.put(SORT_QUEUE_KEY, queue); + streamContext.put(SORT_DOC_KEY, sortDoc); + streamContext.put(TOTAL_HITS_KEY, totalHits); + streamContext.put(EXPORT_WRITER_KEY, this); + streamContext.put(LEAF_READERS_KEY, leaves); + TupleStream tupleStream = createTupleStream(); + tupleStream.open(); + for (;;) { + final Tuple t = tupleStream.read(); + if (t == null) { + break; + } + if (t.EOF) { + break; + } + writer.add((MapWriter) ew -> t.writeMap(ew)); + } + tupleStream.close(); + } else { + int count = 0; + while (count < totalHits) { Review comment: It's the same structure as in `writeDocs(...)`. Yeah, I can change it in both places. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org