BaseResponseWriter.SingleResponseWriter (Solr 3.6.2 API)
Keywords: org.apache.solr.response.BaseResponseWriter.SingleResponseWriter class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.response
Class BaseResponseWriter.SingleResponseWriter

    java.lang.Object
      org.apache.solr.response.BaseResponseWriter.SingleResponseWriter

Enclosing class:
  BaseResponseWriter

    public abstract static class BaseResponseWriter.SingleResponseWriter

extends Object

Users wanting to define custom `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 purpose

Constructor Summary
`BaseResponseWriter.SingleResponseWriter()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BaseResponseWriter.SingleResponseWriter

    public BaseResponseWriter.SingleResponseWriter()

Method Detail

### start

    public void start()
               throws IOException

  This method is called at the start of the `QueryResponseWriter` output. Override this method if you want to provide a header for your output, e.g., XML headers, etc.

  Throws:
    `IOException` - if any error occurs.

### startDocumentList

    public void startDocumentList(String name,
                                  BaseResponseWriter.DocListInfo info)
                           throws IOException

  This method is called at the start of processing a `SolrDocumentList`. Those that override this method are provided with `BaseResponseWriter.DocListInfo` object to use to inspect the output `SolrDocumentList`.

  Parameters:
    `info` - Information about the `SolrDocumentList` to output.
  Throws:
    `IOException`

### writeDoc

    public void writeDoc(SolrDocument solrDocument)
                  throws IOException

  This method writes out a `SolrDocument`, on a doc-by-doc basis. This method is only called when `isStreamingDocs()` returns true.

  Parameters:
    `solrDocument` - The doc-by-doc `SolrDocument` to transform into output as part of this `QueryResponseWriter`.
  Throws:
    `IOException`

### endDocumentList

    public void endDocumentList()
                         throws IOException

  This method is called at the end of outputting a `SolrDocumentList` or on a doc-by-doc `SolrDocument` basis.

  Throws:
    `IOException`

### writeResponseHeader

    public void writeResponseHeader(NamedList responseHeader)
                             throws IOException

  This method defines how to output the `SolrQueryResponse` header which is provided as a `NamedList` parameter.

  Parameters:
    `responseHeader` - The response header to output.
  Throws:
    `IOException`

### end

    public void end()
             throws IOException

  This method is called at the end of the `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.

  Throws:
    `IOException` - If any error occurs.

### writeOther

    public void writeOther(String name,
                           Object other)
                    throws IOException

  Define this method to control how output is written by this `QueryResponseWriter` if the output is not a `SolrInputDocument` or a `SolrDocumentList`.

  Parameters:
    `name` - The name of the object to output.
    `other` - The object to output.
  Throws:
    `IOException` - If any error occurs.

### isStreamingDocs

    public 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. 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. one

  Returns:
    True to force `writeDoc(SolrDocument)` to be called, False to force `writeAllDocs(org.apache.solr.response.BaseResponseWriter.DocListInfo, List)` to be called.

### writeAllDocs

    public void writeAllDocs(BaseResponseWriter.DocListInfo info,
                             List<SolrDocument> allDocs)
                      throws IOException

  Writes out all `SolrInputDocument`s . This is invoked only if `isStreamingDocs()` returns false.

  Parameters:
    `info` - Information about the `List` of `SolrDocument`s to output.
    `allDocs` - A `List` of `SolrDocument`s to output.
  Throws:
    `IOException` - If any error occurs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD