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.RawWriterpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected void writeException(Exception e, PushWriter w, boolean logException) throws IOException
IOExceptionpublic void write(OutputStream os) throws IOException
write in interface SolrCore.RawWriterIOExceptionprotected void identifyLowestSortingUnexportedDocs(List<LeafReaderContext> leaves, org.apache.solr.handler.export.SortDoc sortDoc, org.apache.solr.handler.export.SortQueue queue) throws IOException
IOExceptionprotected 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
IOExceptionprotected void writeDocs(SolrQueryRequest req, IteratorWriter.ItemWriter writer, Sort sort) throws IOException
IOExceptionprotected void writeDoc(org.apache.solr.handler.export.SortDoc sortDoc,
List<LeafReaderContext> leaves,
MapWriter.EntryWriter ew)
throws IOException
IOExceptionprotected org.apache.solr.handler.export.FieldWriter[] getFieldWriters(String[] fields, SolrIndexSearcher searcher) throws IOException
IOExceptionCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.