Package org.apache.solr.handler.export
Class ExportWriter
- java.lang.Object
-
- org.apache.solr.handler.export.ExportWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,SolrCore.RawWriter
public class ExportWriter extends Object implements SolrCore.RawWriter, Closeable
Prepares and writes the documents requested by /export requestsExportWritergathers 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 docs (default is
DEFAULT_BATCH_SIZE) 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExportWriter.IgnoreException
-
Field Summary
Fields Modifier and Type Field Description static StringBATCH_SIZE_PARAMstatic intDEFAULT_BATCH_SIZEstatic intDEFAULT_QUEUE_SIZEstatic StringQUEUE_SIZE_PARAM
-
Constructor Summary
Constructors Constructor Description ExportWriter(SolrQueryRequest req, SolrQueryResponse res, String wt, StreamContext initialStreamContext, SolrMetricsContext solrMetricsContext, String metricsPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetContentType()List<org.apache.solr.handler.export.FieldWriter>getFieldWriters(String[] fields, SolrQueryRequest req)org.apache.solr.handler.export.ExportWriter.MergeIteratorgetMergeIterator(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.util.FixedBitSet[] bits, org.apache.solr.handler.export.SortDoc sortDoc)voidwrite(OutputStream os)protected voidwriteDocs(SolrQueryRequest req, OutputStream os, org.apache.solr.common.IteratorWriter.ItemWriter writer, org.apache.lucene.search.Sort sort)protected voidwriteException(Exception e, org.apache.solr.common.PushWriter w, boolean logException)
-
-
-
Field Detail
-
BATCH_SIZE_PARAM
public static final String BATCH_SIZE_PARAM
- See Also:
- Constant Field Values
-
QUEUE_SIZE_PARAM
public static final String QUEUE_SIZE_PARAM
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_QUEUE_SIZE
public static final int DEFAULT_QUEUE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExportWriter
public ExportWriter(SolrQueryRequest req, SolrQueryResponse res, String wt, StreamContext initialStreamContext, SolrMetricsContext solrMetricsContext, String metricsPath)
-
-
Method Detail
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceSolrCore.RawWriter
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
writeException
protected void writeException(Exception e, org.apache.solr.common.PushWriter w, boolean logException) throws IOException
- Throws:
IOException
-
write
public void write(OutputStream os) throws IOException
- Specified by:
writein interfaceSolrCore.RawWriter- Throws:
IOException
-
writeDocs
protected void writeDocs(SolrQueryRequest req, OutputStream os, org.apache.solr.common.IteratorWriter.ItemWriter writer, org.apache.lucene.search.Sort sort) throws IOException
- Throws:
IOException
-
getFieldWriters
public List<org.apache.solr.handler.export.FieldWriter> getFieldWriters(String[] fields, SolrQueryRequest req) throws IOException
- Throws:
IOException
-
getMergeIterator
public org.apache.solr.handler.export.ExportWriter.MergeIterator getMergeIterator(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.util.FixedBitSet[] bits, org.apache.solr.handler.export.SortDoc sortDoc) throws IOException
- Throws:
IOException
-
-