public class JSONResponse extends QueryableResponse
FUSION_NODE
DEFAULT_CHARSET
Constructor and Description |
---|
JSONResponse() |
JSONResponse(Map<String,Object> tree) |
Modifier and Type | Method and Description |
---|---|
void |
appendMultiMap(String name,
MultivaluedMap<String,String> params) |
void |
appendObject(String name,
Object value) |
void |
appendString(String name,
String value) |
void |
appendStringList(String name,
List<String> values) |
static JSONResponse |
create(InputStream is) |
static JSONResponse |
create(String json) |
Optional<String> |
getContentCharset() |
Optional<String> |
getContentType() |
Optional<String> |
getCursorMark() |
Map<String,Map<String,Object>> |
getFacets()
Return facet info as nested objects: {facet type -> field name -> facet count entries}
NOTE: The actual Java type of facet count entries may differ between implementations.
|
List<Map<String,Object>> |
getGroups(String groupField)
Return groups in the response with all accompanying document data
Each list entry contains information about the groupValue and the Solr doclist (which includes the docs as well as
numFound and rows info).
|
List<String> |
getGroupValues()
If group=true, return an ordered list of group values
|
List<String> |
getGroupValues(String groupField)
If group=true, return an ordered list of group values
|
Map<String,Map<String,Object>> |
getHighlighting()
Return highlighting info as nested objects: {Doc ID -> Field name -> Snippets}
Makes defensive copies, detached from underlying response object.
|
Optional<Double> |
getMaxScore()
Return Solr maxScore
|
Optional<MediaType> |
getMediaType() |
Optional<Long> |
getNumFound()
Return Solr numFound
|
Optional<Long> |
getQTime()
Return Solr QTime
|
Map<String,Object> |
getResponseHeaderParams()
Get params in responseHeader
Makes defensive copies, detached from underlying response object.
|
Optional<Long> |
getStart() |
Optional<Long> |
getTotalTime()
Return Fusion Query Pipeline time
|
Map<String,Object> |
getUnderlyingObject() |
boolean |
isGrouped()
Checks to see if response is grouped (group=true Solr parameter)
See https://lucene.apache.org/solr/guide/7_4/result-grouping.html
|
void |
reorderGroupValues(String groupField,
List<String> groupValues)
Reorder group values in the response.
|
void |
setNumFound(Long numFound) |
void |
setStart(Long start) |
boolean |
setTotalTime(Long time)
Set Fusion Query Pipeline time if and only if the responseHeader object already exists.
|
void |
updateFacets(Map<String,Map<String,Object>> facets)
Update facets in underlying response object
|
void |
updateHighlighting(Map<String,Map<String,Object>> highlighting)
Update highlighting in underlying response object
|
boolean |
updateResponseHeaderParams(Map<String,Object> responseHeaderParams)
Update responseHeader params if and only if responseHeader already exists.
|
void |
write(OutputStream os) |
iterate, matches, query
getDocIds, getDocIds, getDocuments, getDocumentsForGroupValue, getDocumentsForGroupValue, toByteArray, toString, updateDocuments, updateDocumentsForGroupValue, updateDocumentsForGroupValue
public static JSONResponse create(String json) throws IOException
IOException
public static JSONResponse create(InputStream is) throws IOException
IOException
public void appendString(String name, String value)
appendString
in class AbstractResponse
public void appendStringList(String name, List<String> values)
appendStringList
in class AbstractResponse
public void appendMultiMap(String name, MultivaluedMap<String,String> params)
appendMultiMap
in class AbstractResponse
public void write(OutputStream os) throws IOException
IOException
public Map<String,Object> getUnderlyingObject()
getUnderlyingObject
in class AbstractResponse
public Optional<Long> getQTime()
AbstractResponse
getQTime
in class AbstractResponse
public Optional<Long> getTotalTime()
AbstractResponse
getTotalTime
in class AbstractResponse
public boolean setTotalTime(Long time)
AbstractResponse
setTotalTime
in class AbstractResponse
public Optional<Long> getNumFound()
AbstractResponse
getNumFound
in class AbstractResponse
public void setNumFound(Long numFound)
setNumFound
in class AbstractResponse
public Optional<Double> getMaxScore()
AbstractResponse
getMaxScore
in class AbstractResponse
public Optional<Long> getStart()
getStart
in class AbstractResponse
public Optional<String> getCursorMark()
getCursorMark
in class AbstractResponse
public void setStart(Long start)
setStart
in class AbstractResponse
public Map<String,Object> getResponseHeaderParams()
AbstractResponse
AbstractResponse.updateResponseHeaderParams(Map)
()} to commit the changes to the
actual underlying response object.getResponseHeaderParams
in class AbstractResponse
public boolean updateResponseHeaderParams(Map<String,Object> responseHeaderParams)
AbstractResponse
updateResponseHeaderParams
in class AbstractResponse
public boolean isGrouped()
AbstractResponse
isGrouped
in class AbstractResponse
public List<String> getGroupValues()
AbstractResponse
getGroupValues
in class AbstractResponse
public List<String> getGroupValues(String groupField)
AbstractResponse
getGroupValues
in class AbstractResponse
public List<Map<String,Object>> getGroups(String groupField)
AbstractResponse
AbstractResponse#updateGroups(String, List)
.getGroups
in class AbstractResponse
public void reorderGroupValues(String groupField, List<String> groupValues)
AbstractResponse
reorderGroupValues
in class AbstractResponse
groupField
- group fieldgroupValues
- a list of all group values in the desired orderpublic Map<String,Map<String,Object>> getHighlighting()
AbstractResponse
AbstractResponse.updateHighlighting(Map)
to commit the changes to the
actual underlying response object.getHighlighting
in class AbstractResponse
public void updateHighlighting(Map<String,Map<String,Object>> highlighting)
AbstractResponse
updateHighlighting
in class AbstractResponse
public Map<String,Map<String,Object>> getFacets()
AbstractResponse
AbstractResponse.updateFacets(Map)
to commit the changes to the
actual underlying response object.getFacets
in class AbstractResponse
public void updateFacets(Map<String,Map<String,Object>> facets)
AbstractResponse
updateFacets
in class AbstractResponse