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 Calendar
cal
protected boolean
doIndent
protected int
level
protected SolrQueryRequest
req
protected ReturnFields
returnFields
protected SolrQueryResponse
rsp
protected IndexSchema
schema
protected org.apache.solr.common.util.FastWriter
writer
-
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 void
close()
done with this ResponseWriter...int
decLevel()
boolean
doIndent()
Writer
getWriter()
returns the Writer that the response is being written toint
incLevel()
int
level()
TextResponseWriter
setIndent(boolean doIndent)
void
setLevel(int level)
protected boolean
shouldWriteRaw(String fname, ReturnFields returnFields)
NOTE: strict object equality check againstrawReturnFields
; see javadocs forNO_RAW_FIELDS
void
writeDocuments(String name, ResultContext res)
abstract void
writeEndDocumentList()
abstract void
writeSolrDocument(String name, org.apache.solr.common.SolrDocument doc, ReturnFields fields, int idx)
void
writeSolrDocumentList(String name, org.apache.solr.common.SolrDocumentList docs, ReturnFields fields)
abstract void
writeStartDocumentList(String name, long start, int size, long numFound, Float maxScore, Boolean numFoundExact)
void
writeVal(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 IOException
done with this ResponseWriter... make sure any buffers are flushed to writer- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
doIndent
public boolean doIndent()
- Specified by:
doIndent
in interfaceorg.apache.solr.common.util.TextWriter
-
getWriter
public Writer getWriter()
returns the Writer that the response is being written to- Specified by:
getWriter
in interfaceorg.apache.solr.common.util.TextWriter
-
setLevel
public void setLevel(int level)
-
level
public int level()
- Specified by:
level
in interfaceorg.apache.solr.common.util.TextWriter
-
incLevel
public int incLevel()
- Specified by:
incLevel
in interfaceorg.apache.solr.common.util.TextWriter
-
decLevel
public int decLevel()
- Specified by:
decLevel
in interfaceorg.apache.solr.common.util.TextWriter
-
setIndent
public TextResponseWriter setIndent(boolean doIndent)
- Specified by:
setIndent
in interfaceorg.apache.solr.common.util.TextWriter
-
writeVal
public final void writeVal(String name, Object val, boolean raw) throws IOException
- Specified by:
writeVal
in 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
-
-