public class RawResponse extends AbstractResponse implements Closeable
FUSION_NODEDEFAULT_CHARSET| Constructor and Description |
|---|
RawResponse(InputStream rawResponse,
String contentType,
String charset) |
RawResponse(InputStream rawResponse,
String contentType,
String charset,
boolean failOnUnimplementedMethods) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendMultiMap(String name,
MultivaluedMap<String,String> params) |
void |
appendString(String name,
String value) |
void |
appendStringList(String name,
List<String> values) |
void |
close() |
static RawResponse |
create(InputStream rawResponse,
Optional<MediaType> contentType,
Optional<Charset> charset) |
static RawResponse |
create(InputStream rawResponse,
String contentType,
Optional<Charset> charset) |
static RawResponse |
create(String stringResponse,
Optional<MediaType> contentType,
Optional<Charset> charset) |
Optional<String> |
getContentCharset() |
Optional<String> |
getContentType() |
Optional<String> |
getCursorMark() |
List<String> |
getDocIds(String id) |
List<Map<String,Object>> |
getDocumentFieldValuesForCollapseExpandGroupValue(String groupField,
String groupValue)
Return documents of a specific group value under both "response/doc" and "expanded" sections in response
Makes defensive copies, detached from underlying response object.
|
List<Map<String,Object>> |
getDocumentFieldValuesForGroupValue(String groupField,
String groupValue) |
Map<String,Map<String,Object>> |
getExpandedResults()
Returns all collapse expanded results as a map of collapse field name to grouping data that includes list of docs
|
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.
|
Map<String,Map<String,Object>> |
getGroupedResults()
Returns all grouped results as a map of
string grouped expression (a field name or a query) to grouping data that includes list of groups
For comparison getGroups(String groupField) returns a list of groups for a particular grouping expresion
|
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
|
InputStream |
getRawResponse() |
Map<String,Object> |
getResponseHeaderParams()
Get params in responseHeader
Makes defensive copies, detached from underlying response object.
|
Map<String,Object> |
getSpellcheck()
Returns response of Solr spellcheck handler
|
Optional<Long> |
getStart() |
Optional<Long> |
getTotalTime()
Return Fusion Query Pipeline time
|
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 |
updateDocumentFieldValuesForCollapseExpandGroupValue(String groupField,
String groupValue,
List<Map<String,Object>> updatedDocuments)
Update documents (corresponding to groupValue) in underlying response object
The list of updatedDocuments should include all documents under the groupValue
as this method updates both "response/doc" and "expanded" sections in response
The list of updatedDocuments cannot be empty
|
void |
updateDocumentFieldValuesForGroupValue(String groupField,
String groupValue,
List<Map<String,Object>> updatedDocuments) |
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) |
getDocIds, getDocuments, getDocumentsForGroupValue, getDocumentsForGroupValue, toByteArray, toString, updateDocuments, updateDocumentsForGroupValue, updateDocumentsForGroupValuepublic RawResponse(InputStream rawResponse, String contentType, String charset)
public RawResponse(InputStream rawResponse, String contentType, String charset, boolean failOnUnimplementedMethods)
public void write(OutputStream os) throws IOException
write in interface WriteableResponseIOExceptionpublic Optional<String> getContentType()
getContentType in interface WriteableResponsepublic Optional<String> getContentCharset()
getContentCharset in interface WriteableResponsepublic Optional<MediaType> getMediaType()
getMediaType in interface WriteableResponsepublic static RawResponse create(String stringResponse, Optional<MediaType> contentType, Optional<Charset> charset)
public static RawResponse create(InputStream rawResponse, Optional<MediaType> contentType, Optional<Charset> charset)
public static RawResponse create(InputStream rawResponse, String contentType, Optional<Charset> charset)
public InputStream getRawResponse()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void appendString(String name, String value)
appendString in class AbstractResponsepublic void appendStringList(String name, List<String> values)
appendStringList in class AbstractResponsepublic void appendMultiMap(String name, MultivaluedMap<String,String> params)
appendMultiMap in class AbstractResponsepublic Object getUnderlyingObject()
getUnderlyingObject in class AbstractResponsepublic Optional<Long> getQTime()
AbstractResponsegetQTime in class AbstractResponsepublic Optional<Long> getTotalTime()
AbstractResponsegetTotalTime in class AbstractResponsepublic boolean setTotalTime(Long time)
AbstractResponsesetTotalTime in class AbstractResponsepublic Optional<Long> getNumFound()
AbstractResponsegetNumFound in class AbstractResponsepublic void setNumFound(Long numFound)
setNumFound in class AbstractResponsepublic Optional<Double> getMaxScore()
AbstractResponsegetMaxScore in class AbstractResponsepublic Optional<Long> getStart()
getStart in class AbstractResponsepublic Optional<String> getCursorMark()
getCursorMark in class AbstractResponsepublic void setStart(Long start)
setStart in class AbstractResponsepublic Map<String,Object> getResponseHeaderParams()
AbstractResponseAbstractResponse.updateResponseHeaderParams(Map) ()} to commit the changes to the
actual underlying response object.getResponseHeaderParams in class AbstractResponsepublic boolean updateResponseHeaderParams(Map<String,Object> responseHeaderParams)
AbstractResponseupdateResponseHeaderParams in class AbstractResponsepublic boolean isGrouped()
AbstractResponseisGrouped in class AbstractResponsepublic List<String> getGroupValues()
AbstractResponsegetGroupValues in class AbstractResponsepublic List<String> getGroupValues(String groupField)
AbstractResponsegetGroupValues in class AbstractResponsepublic List<Map<String,Object>> getDocumentFieldValuesForGroupValue(String groupField, String groupValue)
getDocumentFieldValuesForGroupValue in class AbstractResponsepublic List<Map<String,Object>> getDocumentFieldValuesForCollapseExpandGroupValue(String groupField, String groupValue)
AbstractResponseAbstractResponse.updateDocumentFieldValuesForCollapseExpandGroupValue(String, String, List) to persist the changes to the
actual underlying response object.getDocumentFieldValuesForCollapseExpandGroupValue in class AbstractResponsepublic void updateDocumentFieldValuesForGroupValue(String groupField, String groupValue, List<Map<String,Object>> updatedDocuments)
updateDocumentFieldValuesForGroupValue in class AbstractResponsepublic void updateDocumentFieldValuesForCollapseExpandGroupValue(String groupField, String groupValue, List<Map<String,Object>> updatedDocuments)
AbstractResponseupdateDocumentFieldValuesForCollapseExpandGroupValue in class AbstractResponsepublic Map<String,Map<String,Object>> getGroupedResults()
AbstractResponsegetGroupedResults in class AbstractResponsepublic Map<String,Map<String,Object>> getExpandedResults()
AbstractResponsegetExpandedResults in class AbstractResponsepublic List<Map<String,Object>> getGroups(String groupField)
AbstractResponsegetGroups in class AbstractResponsepublic void reorderGroupValues(String groupField, List<String> groupValues)
AbstractResponsereorderGroupValues in class AbstractResponsegroupField - group fieldgroupValues - a list of all group values in the desired orderpublic Map<String,Map<String,Object>> getHighlighting()
AbstractResponseAbstractResponse.updateHighlighting(Map) to commit the changes to the
actual underlying response object.getHighlighting in class AbstractResponsepublic void updateHighlighting(Map<String,Map<String,Object>> highlighting)
AbstractResponseupdateHighlighting in class AbstractResponsepublic Map<String,Map<String,Object>> getFacets()
AbstractResponseAbstractResponse.updateFacets(Map) to commit the changes to the
actual underlying response object.getFacets in class AbstractResponsepublic void updateFacets(Map<String,Map<String,Object>> facets)
AbstractResponseupdateFacets in class AbstractResponsepublic Map<String,Object> getSpellcheck()
AbstractResponsegetSpellcheck in class AbstractResponsepublic List<String> getDocIds(String id)
getDocIds in class AbstractResponse