dsmiley commented on a change in pull request #2356: URL: https://github.com/apache/lucene-solr/pull/2356#discussion_r579854153
########## File path: solr/core/src/java/org/apache/solr/util/ExportTool.java ########## @@ -319,6 +369,91 @@ private Object constructDateStr(Object field) { return field; } } + + static class JsonlSink extends DocsSink { + private CharArr charArr = new CharArr(1024 * 2); + JSONWriter jsonWriter = new JSONWriter(charArr, -1); + private Writer writer; + + public JsonlSink(Info info) { + this.info = info; + } + + @Override + public void start() throws IOException { + fos = new FileOutputStream(info.out); + if(info.out.endsWith(".jsonl.gz")) { + fos = new GZIPOutputStream(fos); + } + if (info.bufferSize > 0) { + fos = new BufferedOutputStream(fos, info.bufferSize); + } + writer = new OutputStreamWriter(fos, StandardCharsets.UTF_8); + + } + + @Override + public void end() throws IOException { + writer.flush(); + fos.flush(); + fos.close(); + } + + @Override + @SuppressWarnings({"unchecked", "rawtypes"}) + public synchronized void accept(SolrDocument doc) throws IOException { + charArr.reset(); + int mapSize = doc._size(); + if(doc.hasChildDocuments()) { + mapSize ++; + } + Map m = new LinkedHashMap(mapSize); + + doc.forEach((s, field) -> { + if (s.equals("_version_") || s.equals("_root_")) return; Review comment: constants on IndexSchema ---------------------------------------------------------------- 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