public class ExportWriter extends Object implements SolrCore.RawWriter, Closeable
ExportWriter
gathers and sorts the documents for a core using "stream sorting".
Stream sorting works by repeatedly processing and modifying a bitmap of matching documents. Each pass over the
bitmap identifies the smallest DOCUMENT_BATCH_SIZE
docs that haven't been sent yet and stores them in a
Priority Queue. They are then exported (written across the wire) and marked as sent (unset in the bitmap).
This process repeats until all matching documents have been sent.
This streaming approach is light on memory (only DOCUMENT_BATCH_SIZE
documents are ever stored in memory at
once), and it allows ExportWriter
to scale well with regard to numDocs.
Modifier and Type | Class and Description |
---|---|
static class |
ExportWriter.IgnoreException |
Constructor and Description |
---|
ExportWriter(SolrQueryRequest req,
SolrQueryResponse res,
String wt) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDocsToItemWriter(List<LeafReaderContext> leaves,
IteratorWriter.ItemWriter writer,
org.apache.solr.handler.export.SortDoc[] docsToExport,
int outDocsIndex) |
void |
close() |
String |
getContentType() |
protected org.apache.solr.handler.export.FieldWriter[] |
getFieldWriters(String[] fields,
SolrIndexSearcher searcher) |
protected void |
identifyLowestSortingUnexportedDocs(List<LeafReaderContext> leaves,
org.apache.solr.handler.export.SortDoc sortDoc,
org.apache.solr.handler.export.SortQueue queue) |
protected int |
transferBatchToArrayForOutput(org.apache.solr.handler.export.SortQueue queue,
org.apache.solr.handler.export.SortDoc[] destinationArr) |
void |
write(OutputStream os) |
protected void |
writeDoc(org.apache.solr.handler.export.SortDoc sortDoc,
List<LeafReaderContext> leaves,
MapWriter.EntryWriter ew) |
protected void |
writeDocs(SolrQueryRequest req,
IteratorWriter.ItemWriter writer,
Sort sort) |
protected void |
writeException(Exception e,
PushWriter w,
boolean logException) |
public ExportWriter(SolrQueryRequest req, SolrQueryResponse res, String wt)
public String getContentType()
getContentType
in interface SolrCore.RawWriter
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected void writeException(Exception e, PushWriter w, boolean logException) throws IOException
IOException
public void write(OutputStream os) throws IOException
write
in interface SolrCore.RawWriter
IOException
protected void identifyLowestSortingUnexportedDocs(List<LeafReaderContext> leaves, org.apache.solr.handler.export.SortDoc sortDoc, org.apache.solr.handler.export.SortQueue queue) throws IOException
IOException
protected int transferBatchToArrayForOutput(org.apache.solr.handler.export.SortQueue queue, org.apache.solr.handler.export.SortDoc[] destinationArr)
protected void addDocsToItemWriter(List<LeafReaderContext> leaves, IteratorWriter.ItemWriter writer, org.apache.solr.handler.export.SortDoc[] docsToExport, int outDocsIndex) throws IOException
IOException
protected void writeDocs(SolrQueryRequest req, IteratorWriter.ItemWriter writer, Sort sort) throws IOException
IOException
protected void writeDoc(org.apache.solr.handler.export.SortDoc sortDoc, List<LeafReaderContext> leaves, MapWriter.EntryWriter ew) throws IOException
IOException
protected org.apache.solr.handler.export.FieldWriter[] getFieldWriters(String[] fields, SolrIndexSearcher searcher) throws IOException
IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.