public class XMLResponse extends QueryableResponse
FUSION_NODE
DEFAULT_CHARSET
Constructor and Description |
---|
XMLResponse() |
XMLResponse(Document document) |
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) |
static XMLResponse |
create(InputStream is) |
static XMLResponse |
create(String xml) |
static XMLResponse |
create(String xml,
Charset charset) |
Optional<String> |
getContentCharset() |
Optional<String> |
getContentType() |
Optional<String> |
getCursorMark() |
List<String> |
getDocIds(String docIdField) |
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.
|
Map<String,Object> |
getJsonFacets() |
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.
|
Map<String,Object> |
getSpellcheck()
Returns response of Solr spellcheck handler
|
Optional<Long> |
getStart() |
Optional<Long> |
getTotalTime()
Return Fusion Query Pipeline time
|
Document |
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) |
iterate, matches, query
getDocIds, getDocuments, getDocumentsForGroupValue, getDocumentsForGroupValue, toByteArray, toString, updateDocuments, updateDocumentsForGroupValue, updateDocumentsForGroupValue
public XMLResponse(Document document)
public XMLResponse()
public static XMLResponse create(String xml) throws ParserConfigurationException, IOException, SAXException
public static XMLResponse create(String xml, Charset charset) throws ParserConfigurationException, IOException, SAXException
public static XMLResponse create(InputStream is) throws ParserConfigurationException, IOException, SAXException
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 Document 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>> getDocumentFieldValuesForGroupValue(String groupField, String groupValue)
getDocumentFieldValuesForGroupValue
in class AbstractResponse
public List<Map<String,Object>> getDocumentFieldValuesForCollapseExpandGroupValue(String groupField, String groupValue)
AbstractResponse
AbstractResponse.updateDocumentFieldValuesForCollapseExpandGroupValue(String, String, List)
to persist the changes to the
actual underlying response object.getDocumentFieldValuesForCollapseExpandGroupValue
in class AbstractResponse
public void updateDocumentFieldValuesForGroupValue(String groupField, String groupValue, List<Map<String,Object>> updatedDocuments)
updateDocumentFieldValuesForGroupValue
in class AbstractResponse
public void updateDocumentFieldValuesForCollapseExpandGroupValue(String groupField, String groupValue, List<Map<String,Object>> updatedDocuments)
AbstractResponse
updateDocumentFieldValuesForCollapseExpandGroupValue
in class AbstractResponse
public Map<String,Map<String,Object>> getExpandedResults()
AbstractResponse
getExpandedResults
in class AbstractResponse
public Map<String,Map<String,Object>> getGroupedResults()
AbstractResponse
getGroupedResults
in class AbstractResponse
public List<Map<String,Object>> getGroups(String groupField)
AbstractResponse
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 Map<String,Object> getJsonFacets()
getJsonFacets
in class AbstractResponse
public void updateFacets(Map<String,Map<String,Object>> facets)
AbstractResponse
updateFacets
in class AbstractResponse
public Map<String,Object> getSpellcheck()
AbstractResponse
getSpellcheck
in class AbstractResponse
public List<String> getDocIds(String docIdField)
getDocIds
in class AbstractResponse