class JSONWriter extends TextResponseWriter
Modifier and Type | Class and Description |
---|---|
protected static class |
JSONWriter.MultiValueField |
Modifier and Type | Field and Description |
---|---|
private java.util.Calendar |
cal |
private static char[] |
hexdigits |
private static java.lang.String |
JSON_NL_ARROFARR |
private static java.lang.String |
JSON_NL_ARROFMAP |
private static java.lang.String |
JSON_NL_FLAT |
private static java.lang.String |
JSON_NL_MAP |
private static java.lang.String |
JSON_NL_STYLE |
private static java.lang.String |
JSON_WRAPPER_FUNCTION |
private java.lang.String |
namedListStyle |
private java.util.HashMap |
scoreMap |
private java.lang.String |
wrapperFunction |
doIndent, level, req, returnFields, rsp, schema, writer
Constructor and Description |
---|
JSONWriter(java.io.Writer writer,
SolrQueryRequest req,
SolrQueryResponse rsp) |
Modifier and Type | Method and Description |
---|---|
protected static void |
unicodeEscape(java.lang.Appendable out,
int ch) |
void |
writeArray(java.lang.String name,
java.util.Iterator val) |
void |
writeArray(java.lang.String name,
java.lang.Object[] val) |
void |
writeArrayCloser() |
void |
writeArrayOpener(int size) |
void |
writeArraySeparator() |
void |
writeBool(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Java string form of a boolean
|
void |
writeByte(java.lang.String name,
java.lang.String val) |
void |
writeDate(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Solr ISO8601 based date format
|
void |
writeDoc(java.lang.String name,
java.util.Collection<org.apache.lucene.document.Fieldable> fields,
java.util.Set<java.lang.String> returnFields,
java.util.Map pseudoFields) |
void |
writeDoc(java.lang.String name,
org.apache.lucene.document.Document doc,
java.util.Set<java.lang.String> returnFields,
float score,
boolean includeScore) |
void |
writeDocList(java.lang.String name,
DocList ids,
java.util.Set<java.lang.String> fields,
java.util.Map otherFields) |
void |
writeDouble(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Java string form of a double
|
void |
writeFloat(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Java string form of a float
|
void |
writeInt(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Java string form of an int
|
protected void |
writeKey(java.lang.String fname,
boolean needsEscaping) |
void |
writeLong(java.lang.String name,
java.lang.String val)
if this form of the method is called, val is the Java string form of a long
|
void |
writeMap(java.lang.String name,
java.util.Map val,
boolean excludeOuter,
boolean isFirstVal) |
void |
writeMapCloser() |
void |
writeMapOpener(int size) |
void |
writeMapSeparator() |
void |
writeNamedList(java.lang.String name,
NamedList val) |
protected void |
writeNamedListAsArrArr(java.lang.String name,
NamedList val) |
protected void |
writeNamedListAsArrMap(java.lang.String name,
NamedList val) |
protected void |
writeNamedListAsFlat(java.lang.String name,
NamedList val) |
protected void |
writeNamedListAsMapMangled(java.lang.String name,
NamedList val)
Represents a NamedList directly as a JSON Object (essentially a Map)
Map null to "" and name mangle any repeated keys to avoid repeats in the
output.
|
protected void |
writeNamedListAsMapWithDups(java.lang.String name,
NamedList val)
Represents a NamedList directly as a JSON Object (essentially a Map)
repeating any keys if they are repeated in the NamedList.
|
void |
writeNull(java.lang.String name) |
void |
writeResponse() |
void |
writeShort(java.lang.String name,
java.lang.String val) |
void |
writeSolrDocument(java.lang.String name,
SolrDocument doc,
java.util.Set<java.lang.String> returnFields,
java.util.Map pseudoFields) |
void |
writeSolrDocumentList(java.lang.String name,
SolrDocumentList docs,
java.util.Set<java.lang.String> fields,
java.util.Map otherFields) |
void |
writeStr(java.lang.String name,
java.lang.String val,
boolean needsEscaping) |
close, decLevel, getWriter, incLevel, indent, indent, level, setIndent, setLevel, writeBool, writeByte, writeDate, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeVal
private java.util.Calendar cal
private java.lang.String namedListStyle
private java.lang.String wrapperFunction
private static final java.lang.String JSON_NL_STYLE
private static final java.lang.String JSON_NL_MAP
private static final java.lang.String JSON_NL_FLAT
private static final java.lang.String JSON_NL_ARROFARR
private static final java.lang.String JSON_NL_ARROFMAP
private static final java.lang.String JSON_WRAPPER_FUNCTION
private final java.util.HashMap scoreMap
private static char[] hexdigits
public JSONWriter(java.io.Writer writer, SolrQueryRequest req, SolrQueryResponse rsp)
public void writeResponse() throws java.io.IOException
java.io.IOException
protected void writeKey(java.lang.String fname, boolean needsEscaping) throws java.io.IOException
java.io.IOException
protected void writeNamedListAsMapMangled(java.lang.String name, NamedList val) throws java.io.IOException
java.io.IOException
protected void writeNamedListAsMapWithDups(java.lang.String name, NamedList val) throws java.io.IOException
java.io.IOException
protected void writeNamedListAsArrMap(java.lang.String name, NamedList val) throws java.io.IOException
java.io.IOException
protected void writeNamedListAsArrArr(java.lang.String name, NamedList val) throws java.io.IOException
java.io.IOException
protected void writeNamedListAsFlat(java.lang.String name, NamedList val) throws java.io.IOException
java.io.IOException
public void writeNamedList(java.lang.String name, NamedList val) throws java.io.IOException
writeNamedList
in class TextResponseWriter
java.io.IOException
public void writeDoc(java.lang.String name, java.util.Collection<org.apache.lucene.document.Fieldable> fields, java.util.Set<java.lang.String> returnFields, java.util.Map pseudoFields) throws java.io.IOException
java.io.IOException
public void writeSolrDocument(java.lang.String name, SolrDocument doc, java.util.Set<java.lang.String> returnFields, java.util.Map pseudoFields) throws java.io.IOException
writeSolrDocument
in class TextResponseWriter
java.io.IOException
public void writeDoc(java.lang.String name, org.apache.lucene.document.Document doc, java.util.Set<java.lang.String> returnFields, float score, boolean includeScore) throws java.io.IOException
writeDoc
in class TextResponseWriter
java.io.IOException
public void writeDocList(java.lang.String name, DocList ids, java.util.Set<java.lang.String> fields, java.util.Map otherFields) throws java.io.IOException
writeDocList
in class TextResponseWriter
java.io.IOException
public void writeSolrDocumentList(java.lang.String name, SolrDocumentList docs, java.util.Set<java.lang.String> fields, java.util.Map otherFields) throws java.io.IOException
writeSolrDocumentList
in class TextResponseWriter
java.io.IOException
public void writeMapOpener(int size) throws java.io.IOException, java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
public void writeMapSeparator() throws java.io.IOException
java.io.IOException
public void writeMapCloser() throws java.io.IOException
java.io.IOException
public void writeArrayOpener(int size) throws java.io.IOException, java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
public void writeArraySeparator() throws java.io.IOException
java.io.IOException
public void writeArrayCloser() throws java.io.IOException
java.io.IOException
public void writeStr(java.lang.String name, java.lang.String val, boolean needsEscaping) throws java.io.IOException
writeStr
in class TextResponseWriter
java.io.IOException
public void writeMap(java.lang.String name, java.util.Map val, boolean excludeOuter, boolean isFirstVal) throws java.io.IOException
writeMap
in class TextResponseWriter
java.io.IOException
public void writeArray(java.lang.String name, java.lang.Object[] val) throws java.io.IOException
writeArray
in class TextResponseWriter
java.io.IOException
public void writeArray(java.lang.String name, java.util.Iterator val) throws java.io.IOException
writeArray
in class TextResponseWriter
java.io.IOException
public void writeNull(java.lang.String name) throws java.io.IOException
writeNull
in class TextResponseWriter
java.io.IOException
public void writeInt(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeInt
in class TextResponseWriter
java.io.IOException
public void writeLong(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeLong
in class TextResponseWriter
java.io.IOException
public void writeBool(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeBool
in class TextResponseWriter
java.io.IOException
public void writeFloat(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeFloat
in class TextResponseWriter
java.io.IOException
public void writeDouble(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeDouble
in class TextResponseWriter
java.io.IOException
public void writeShort(java.lang.String name, java.lang.String val) throws java.io.IOException
writeShort
in class TextResponseWriter
java.io.IOException
public void writeByte(java.lang.String name, java.lang.String val) throws java.io.IOException
writeByte
in class TextResponseWriter
java.io.IOException
public void writeDate(java.lang.String name, java.lang.String val) throws java.io.IOException
TextResponseWriter
writeDate
in class TextResponseWriter
java.io.IOException
protected static void unicodeEscape(java.lang.Appendable out, int ch) throws java.io.IOException
java.io.IOException