Package org.apache.solr.handler.export
Class ExportWriter
java.lang.Object
org.apache.solr.handler.export.ExportWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,SolrCore.RawWriter
Prepares and writes the documents requested by /export requests
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 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 -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExportWriter(SolrQueryRequest req, SolrQueryResponse res, String wt, StreamContext initialStreamContext, SolrMetricsContext solrMetricsContext, String metricsPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 Details
-
BATCH_SIZE_PARAM
- See Also:
-
QUEUE_SIZE_PARAM
- See Also:
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE- See Also:
-
DEFAULT_QUEUE_SIZE
public static final int DEFAULT_QUEUE_SIZE- See Also:
-
-
Constructor Details
-
ExportWriter
public ExportWriter(SolrQueryRequest req, SolrQueryResponse res, String wt, StreamContext initialStreamContext, SolrMetricsContext solrMetricsContext, String metricsPath)
-
-
Method Details
-
getContentType
- Specified by:
getContentTypein interfaceSolrCore.RawWriter
-
close
- 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
- 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
-