public abstract static class BaseResponseWriter.SingleResponseWriter extends Object
QueryResponseWriter
s that deal with
SolrInputDocument
s and SolrDocumentList
should override the
methods for this class. All the methods are w/o body because the user is left
to choose which all methods are required for his purposeConstructor and Description |
---|
BaseResponseWriter.SingleResponseWriter() |
Modifier and Type | Method and Description |
---|---|
void |
end()
This method is called at the end of the
QueryResponseWriter
lifecycle. |
void |
endDocumentList()
This method is called at the end of outputting a
SolrDocumentList
or on a doc-by-doc SolrDocument basis. |
boolean |
isStreamingDocs()
Overriding this method to return false forces all
SolrInputDocument s to be spit out as a SolrDocumentList
so they can be processed as a whole, rather than on a doc-by-doc basis. |
void |
start()
This method is called at the start of the
QueryResponseWriter
output. |
void |
startDocumentList(String name,
BaseResponseWriter.DocListInfo info)
This method is called at the start of processing a
SolrDocumentList . |
void |
writeAllDocs(BaseResponseWriter.DocListInfo info,
List<SolrDocument> allDocs)
Writes out all
SolrInputDocument s . |
void |
writeDoc(SolrDocument solrDocument)
This method writes out a
SolrDocument , on a doc-by-doc basis. |
void |
writeOther(String name,
Object other)
Define this method to control how output is written by this
QueryResponseWriter if the output is not a
SolrInputDocument or a SolrDocumentList . |
void |
writeResponseHeader(NamedList responseHeader)
This method defines how to output the
SolrQueryResponse header
which is provided as a NamedList parameter. |
public BaseResponseWriter.SingleResponseWriter()
public void start() throws IOException
QueryResponseWriter
output. Override this method if you want to provide a header for your
output, e.g., XML headers, etc.IOException
- if any error occurs.public void startDocumentList(String name, BaseResponseWriter.DocListInfo info) throws IOException
SolrDocumentList
. Those that override this method are provided
with BaseResponseWriter.DocListInfo
object to use to inspect the output
SolrDocumentList
.info
- Information about the SolrDocumentList
to output.IOException
public void writeDoc(SolrDocument solrDocument) throws IOException
SolrDocument
, on a doc-by-doc basis.
This method is only called when isStreamingDocs()
returns true.solrDocument
- The doc-by-doc SolrDocument
to transform into output as
part of this QueryResponseWriter
.IOException
public void endDocumentList() throws IOException
SolrDocumentList
or on a doc-by-doc SolrDocument
basis.IOException
public void writeResponseHeader(NamedList responseHeader) throws IOException
SolrQueryResponse
header
which is provided as a NamedList
parameter.responseHeader
- The response header to output.IOException
public void end() throws IOException
QueryResponseWriter
lifecycle. Implement this method to add a footer to your output, e.g., in
the case of XML, the outer tag for your tag set, etc.IOException
- If any error occurs.public void writeOther(String name, Object other) throws IOException
QueryResponseWriter
if the output is not a
SolrInputDocument
or a SolrDocumentList
.name
- The name of the object to output.other
- The object to output.IOException
- If any error occurs.public boolean isStreamingDocs()
SolrInputDocument
s to be spit out as a SolrDocumentList
so they can be processed as a whole, rather than on a doc-by-doc basis.
If set to false, this method calls
writeAllDocs(org.apache.solr.response.BaseResponseWriter.DocListInfo, List)
, else if set to true, then this
method forces calling writeDoc(SolrDocument)
on a doc-by-doc
basis. onewriteDoc(SolrDocument)
to be called, False
to force writeAllDocs(org.apache.solr.response.BaseResponseWriter.DocListInfo, List)
to be called.public void writeAllDocs(BaseResponseWriter.DocListInfo info, List<SolrDocument> allDocs) throws IOException
SolrInputDocument
s . This is invoked only if
isStreamingDocs()
returns false.info
- Information about the List
of SolrDocument
s to
output.allDocs
- A List
of SolrDocument
s to output.IOException
- If any error occurs.