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 requestsExportWriter
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 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 class
ExportWriter.IgnoreException
-
Field Summary
Fields Modifier and Type Field Description static String
BATCH_SIZE_PARAM
static int
DEFAULT_BATCH_SIZE
static int
DEFAULT_QUEUE_SIZE
static String
QUEUE_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 void
close()
String
getContentType()
List<org.apache.solr.handler.export.FieldWriter>
getFieldWriters(String[] fields, SolrQueryRequest req)
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)
void
write(OutputStream os)
protected void
writeDocs(SolrQueryRequest req, OutputStream os, org.apache.solr.common.IteratorWriter.ItemWriter writer, org.apache.lucene.search.Sort sort)
protected void
writeException(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:
getContentType
in interfaceSolrCore.RawWriter
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in 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:
write
in 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
-
-