Package org.apache.solr.response
Class JSONWriter
- java.lang.Object
-
- org.apache.solr.response.TextResponseWriter
-
- org.apache.solr.response.JSONWriter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.solr.common.PushWriter
,org.apache.solr.common.util.JsonTextWriter
,org.apache.solr.common.util.TextWriter
- Direct Known Subclasses:
SmileResponseWriter.SmileWriter
public class JSONWriter extends TextResponseWriter implements org.apache.solr.common.util.JsonTextWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected String
namedListStyle
protected String
wrapperFunction
-
Fields inherited from class org.apache.solr.response.TextResponseWriter
cal, doIndent, level, req, returnFields, rsp, schema, writer
-
-
Constructor Summary
Constructors Constructor Description JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp, String wrapperFunction, String namedListStyle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
_writeChar(char c)
void
_writeStr(String s)
String
getNamedListStyle()
protected int
headerSize(Float maxScore, Boolean numFoundExact)
static void
write(Writer writer, boolean indent, String namedListStyle, Object val)
Strictly for testing onlyvoid
writeEndDocumentList()
void
writeResponse()
void
writeSolrDocument(String name, org.apache.solr.common.SolrDocument doc, ReturnFields returnFields, int idx)
void
writeStartDocumentList(String name, long start, int size, long numFound, Float maxScore, Boolean numFoundExact)
-
Methods inherited from class org.apache.solr.response.TextResponseWriter
close, decLevel, doIndent, getWriter, incLevel, level, setIndent, setLevel, shouldWriteRaw, writeDocuments, writeSolrDocumentList, writeVal
-
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.JsonTextWriter
unicodeEscape, writeArray, writeArray, writeArrayCloser, writeArrayOpener, writeArraySeparator, writeBool, writeDate, writeDouble, writeFloat, writeInt, writeIterator, writeJsonIter, writeKey, writeLong, writeMap, writeMap, writeMapCloser, writeMapOpener, writeMapSeparator, writeNamedList, writeNamedListAsArrArr, writeNamedListAsArrMap, writeNamedListAsFlat, writeNamedListAsMapMangled, writeNamedListAsMapWithDups, writeNull, writeStr, writeStrRaw
-
Methods inherited from interface org.apache.solr.common.util.TextWriter
decLevel, doIndent, getWriter, incLevel, indent, indent, level, setIndent, writeArray, writeBool, writeBool, writeByteArr, writeDate, writeDouble, writeFloat, writeInt, writeIterator, writeLong, writeMap, writeNumber, writeVal, writeVal
-
-
-
-
Constructor Detail
-
JSONWriter
public JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
-
JSONWriter
public JSONWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp, String wrapperFunction, String namedListStyle)
-
-
Method Detail
-
write
public static void write(Writer writer, boolean indent, String namedListStyle, Object val) throws IOException
Strictly for testing only- Throws:
IOException
-
getNamedListStyle
public String getNamedListStyle()
- Specified by:
getNamedListStyle
in interfaceorg.apache.solr.common.util.JsonTextWriter
-
writeResponse
public void writeResponse() throws IOException
- Throws:
IOException
-
writeSolrDocument
public void writeSolrDocument(String name, org.apache.solr.common.SolrDocument doc, ReturnFields returnFields, int idx) throws IOException
- Specified by:
writeSolrDocument
in classTextResponseWriter
- Throws:
IOException
-
writeStartDocumentList
public void writeStartDocumentList(String name, long start, int size, long numFound, Float maxScore, Boolean numFoundExact) throws IOException
- Specified by:
writeStartDocumentList
in classTextResponseWriter
- Throws:
IOException
-
writeEndDocumentList
public void writeEndDocumentList() throws IOException
- Specified by:
writeEndDocumentList
in classTextResponseWriter
- Throws:
IOException
-
_writeChar
public void _writeChar(char c) throws IOException
- Specified by:
_writeChar
in interfaceorg.apache.solr.common.util.JsonTextWriter
- Throws:
IOException
-
_writeStr
public void _writeStr(String s) throws IOException
- Specified by:
_writeStr
in interfaceorg.apache.solr.common.util.JsonTextWriter
- Throws:
IOException
-
-