Package org.apache.solr.response
Class TextResponseWriter
- java.lang.Object
-
- org.apache.solr.response.TextResponseWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.solr.common.PushWriter,org.apache.solr.common.util.TextWriter
- Direct Known Subclasses:
JSONWriter,SchemaXmlWriter,TabularResponseWriter,XMLWriter
public abstract class TextResponseWriter extends Object implements org.apache.solr.common.util.TextWriter
Base class for text-oriented response writers.
-
-
Field Summary
Fields Modifier and Type Field Description protected Calendarcalprotected booleandoIndentprotected intlevelprotected SolrQueryRequestreqprotected ReturnFieldsreturnFieldsprotected SolrQueryResponserspprotected IndexSchemaschemaprotected org.apache.solr.common.util.FastWriterwriter
-
Constructor Summary
Constructors Constructor Description TextResponseWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()done with this ResponseWriter...intdecLevel()booleandoIndent()WritergetWriter()returns the Writer that the response is being written tointincLevel()intlevel()TextResponseWritersetIndent(boolean doIndent)voidsetLevel(int level)protected booleanshouldWriteRaw(String fname, ReturnFields returnFields)NOTE: strict object equality check againstrawReturnFields; see javadocs forNO_RAW_FIELDSvoidwriteDocuments(String name, ResultContext res)abstract voidwriteEndDocumentList()abstract voidwriteSolrDocument(String name, org.apache.solr.common.SolrDocument doc, ReturnFields fields, int idx)voidwriteSolrDocumentList(String name, org.apache.solr.common.SolrDocumentList docs, ReturnFields fields)abstract voidwriteStartDocumentList(String name, long start, int size, long numFound, Float maxScore, Boolean numFoundExact)voidwriteVal(String name, Object val, boolean raw)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.util.TextWriter
indent, indent, writeArray, writeArray, writeArray, writeBool, writeBool, writeBool, writeByteArr, writeDate, writeDate, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeIterator, writeIterator, writeLong, writeLong, writeMap, writeMap, writeMap, writeNamedList, writeNull, writeNumber, writeStr, writeStrRaw, writeVal
-
-
-
-
Field Detail
-
writer
protected final org.apache.solr.common.util.FastWriter writer
-
schema
protected final IndexSchema schema
-
req
protected final SolrQueryRequest req
-
rsp
protected final SolrQueryResponse rsp
-
returnFields
protected ReturnFields returnFields
-
level
protected int level
-
doIndent
protected boolean doIndent
-
cal
protected Calendar cal
-
-
Constructor Detail
-
TextResponseWriter
public TextResponseWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
-
-
Method Detail
-
shouldWriteRaw
protected final boolean shouldWriteRaw(String fname, ReturnFields returnFields)
NOTE: strict object equality check againstrawReturnFields; see javadocs forNO_RAW_FIELDS
-
close
public void close() throws IOExceptiondone with this ResponseWriter... make sure any buffers are flushed to writer- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
doIndent
public boolean doIndent()
- Specified by:
doIndentin interfaceorg.apache.solr.common.util.TextWriter
-
getWriter
public Writer getWriter()
returns the Writer that the response is being written to- Specified by:
getWriterin interfaceorg.apache.solr.common.util.TextWriter
-
setLevel
public void setLevel(int level)
-
level
public int level()
- Specified by:
levelin interfaceorg.apache.solr.common.util.TextWriter
-
incLevel
public int incLevel()
- Specified by:
incLevelin interfaceorg.apache.solr.common.util.TextWriter
-
decLevel
public int decLevel()
- Specified by:
decLevelin interfaceorg.apache.solr.common.util.TextWriter
-
setIndent
public TextResponseWriter setIndent(boolean doIndent)
- Specified by:
setIndentin interfaceorg.apache.solr.common.util.TextWriter
-
writeVal
public final void writeVal(String name, Object val, boolean raw) throws IOException
- Specified by:
writeValin interfaceorg.apache.solr.common.util.TextWriter- Throws:
IOException
-
writeStartDocumentList
public abstract void writeStartDocumentList(String name, long start, int size, long numFound, Float maxScore, Boolean numFoundExact) throws IOException
- Throws:
IOException
-
writeSolrDocument
public abstract void writeSolrDocument(String name, org.apache.solr.common.SolrDocument doc, ReturnFields fields, int idx) throws IOException
- Throws:
IOException
-
writeEndDocumentList
public abstract void writeEndDocumentList() throws IOException- Throws:
IOException
-
writeSolrDocumentList
public final void writeSolrDocumentList(String name, org.apache.solr.common.SolrDocumentList docs, ReturnFields fields) throws IOException
- Throws:
IOException
-
writeDocuments
public final void writeDocuments(String name, ResultContext res) throws IOException
- Throws:
IOException
-
-