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, writeValprivate 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.IOExceptionprotected void writeKey(java.lang.String fname,
boolean needsEscaping)
throws java.io.IOException
java.io.IOExceptionprotected void writeNamedListAsMapMangled(java.lang.String name,
NamedList val)
throws java.io.IOException
java.io.IOExceptionprotected void writeNamedListAsMapWithDups(java.lang.String name,
NamedList val)
throws java.io.IOException
java.io.IOExceptionprotected void writeNamedListAsArrMap(java.lang.String name,
NamedList val)
throws java.io.IOException
java.io.IOExceptionprotected void writeNamedListAsArrArr(java.lang.String name,
NamedList val)
throws java.io.IOException
java.io.IOExceptionprotected void writeNamedListAsFlat(java.lang.String name,
NamedList val)
throws java.io.IOException
java.io.IOExceptionpublic void writeNamedList(java.lang.String name,
NamedList val)
throws java.io.IOException
writeNamedList in class TextResponseWriterjava.io.IOExceptionpublic 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.IOExceptionpublic 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 TextResponseWriterjava.io.IOExceptionpublic 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 TextResponseWriterjava.io.IOExceptionpublic 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 TextResponseWriterjava.io.IOExceptionpublic 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 TextResponseWriterjava.io.IOExceptionpublic void writeMapOpener(int size)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.io.IOExceptionjava.lang.IllegalArgumentExceptionpublic void writeMapSeparator()
throws java.io.IOException
java.io.IOExceptionpublic void writeMapCloser()
throws java.io.IOException
java.io.IOExceptionpublic void writeArrayOpener(int size)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.io.IOExceptionjava.lang.IllegalArgumentExceptionpublic void writeArraySeparator()
throws java.io.IOException
java.io.IOExceptionpublic void writeArrayCloser()
throws java.io.IOException
java.io.IOExceptionpublic void writeStr(java.lang.String name,
java.lang.String val,
boolean needsEscaping)
throws java.io.IOException
writeStr in class TextResponseWriterjava.io.IOExceptionpublic void writeMap(java.lang.String name,
java.util.Map val,
boolean excludeOuter,
boolean isFirstVal)
throws java.io.IOException
writeMap in class TextResponseWriterjava.io.IOExceptionpublic void writeArray(java.lang.String name,
java.lang.Object[] val)
throws java.io.IOException
writeArray in class TextResponseWriterjava.io.IOExceptionpublic void writeArray(java.lang.String name,
java.util.Iterator val)
throws java.io.IOException
writeArray in class TextResponseWriterjava.io.IOExceptionpublic void writeNull(java.lang.String name)
throws java.io.IOException
writeNull in class TextResponseWriterjava.io.IOExceptionpublic void writeInt(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteInt in class TextResponseWriterjava.io.IOExceptionpublic void writeLong(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteLong in class TextResponseWriterjava.io.IOExceptionpublic void writeBool(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteBool in class TextResponseWriterjava.io.IOExceptionpublic void writeFloat(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteFloat in class TextResponseWriterjava.io.IOExceptionpublic void writeDouble(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteDouble in class TextResponseWriterjava.io.IOExceptionpublic void writeShort(java.lang.String name,
java.lang.String val)
throws java.io.IOException
writeShort in class TextResponseWriterjava.io.IOExceptionpublic void writeByte(java.lang.String name,
java.lang.String val)
throws java.io.IOException
writeByte in class TextResponseWriterjava.io.IOExceptionpublic void writeDate(java.lang.String name,
java.lang.String val)
throws java.io.IOException
TextResponseWriterwriteDate in class TextResponseWriterjava.io.IOExceptionprotected static void unicodeEscape(java.lang.Appendable out,
int ch)
throws java.io.IOException
java.io.IOException