Class AbstractResponse

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      abstract void appendMultiMap​(java.lang.String name, MultivaluedMap<java.lang.String,​java.lang.String> params)  
      abstract void appendString​(java.lang.String name, java.lang.String value)  
      abstract void appendStringList​(java.lang.String name, java.util.List<java.lang.String> values)  
      abstract java.util.Optional<java.lang.String> getCursorMark()  
      java.util.List<java.lang.String> getDocIds()
      Convenience method for returning all doc ids
      abstract java.util.List<java.lang.String> getDocIds​(java.lang.String id)  
      abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getDocumentFieldValuesForCollapseExpandGroupValue​(java.lang.String groupField, java.lang.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.
      abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getDocumentFieldValuesForGroupValue​(java.lang.String groupField, java.lang.String groupValue)  
      java.util.List<ResponseDocument> getDocuments()
      Returns documents.
      java.util.List<ResponseDocument> getDocumentsForGroupValue​(java.lang.String groupValue)
      java.util.List<ResponseDocument> getDocumentsForGroupValue​(java.lang.String groupField, java.lang.String groupValue)
      Returns documents (corresponding to groupValue) Makes defensive copies, detached from underlying response object.
      abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> getExpandedResults()
      Returns all collapse expanded results as a map of collapse field name to grouping data that includes list of docs
      abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.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.
      abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.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
      abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getGroups​(java.lang.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).
      abstract java.util.List<java.lang.String> getGroupValues()
      Deprecated.
      abstract java.util.List<java.lang.String> getGroupValues​(java.lang.String groupField)
      If group=true, return an ordered list of group values
      abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> getHighlighting()
      Return highlighting info as nested objects: {Doc ID -> Field name -> Snippets} Makes defensive copies, detached from underlying response object.
      abstract java.util.Map<java.lang.String,​java.lang.Object> getJsonFacets()  
      abstract java.util.Optional<java.lang.Double> getMaxScore()
      Return Solr maxScore
      abstract java.util.Optional<java.lang.Long> getNumFound()
      Return Solr numFound
      abstract java.util.Optional<java.lang.Long> getQTime()
      Return Solr QTime
      abstract java.util.Map<java.lang.String,​java.lang.Object> getResponseHeaderParams()
      Get params in responseHeader Makes defensive copies, detached from underlying response object.
      abstract java.util.Map<java.lang.String,​java.lang.Object> getSpellcheck()
      Returns response of Solr spellcheck handler
      abstract java.util.Optional<java.lang.Long> getStart()  
      abstract java.util.Optional<java.lang.Long> getTotalTime()
      Return Fusion Query Pipeline time
      abstract java.lang.Object getUnderlyingObject()  
      abstract 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
      abstract void reorderGroupValues​(java.lang.String groupField, java.util.List<java.lang.String> groupValues)
      Reorder group values in the response.
      abstract void setNumFound​(java.lang.Long numFound)  
      abstract void setStart​(java.lang.Long start)  
      abstract boolean setTotalTime​(java.lang.Long time)
      Set Fusion Query Pipeline time if and only if the responseHeader object already exists.
      byte[] toByteArray()  
      java.lang.String toString()  
      abstract void updateDocumentFieldValuesForCollapseExpandGroupValue​(java.lang.String groupField, java.lang.String groupValue, java.util.List<java.util.Map<java.lang.String,​java.lang.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
      abstract void updateDocumentFieldValuesForGroupValue​(java.lang.String groupField, java.lang.String groupValue, java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> updatedDocuments)  
      void updateDocuments​(java.util.List<ResponseDocument> updatedDocuments)
      Update documents in underlying response object Use this method to commit changes (like reordering, redactions, rewritings) made to document objects returned from getDocuments()
      void updateDocumentsForGroupValue​(java.lang.String groupField, java.lang.String groupValue, java.util.List<ResponseDocument> updatedDocuments)
      Update documents (corresponding to groupValue) in underlying response object
      void updateDocumentsForGroupValue​(java.lang.String groupValue, java.util.List<ResponseDocument> updatedDocuments)
      abstract void updateFacets​(java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> facets)
      Update facets in underlying response object
      abstract void updateHighlighting​(java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> highlighting)
      Update highlighting in underlying response object
      abstract boolean updateResponseHeaderParams​(java.util.Map<java.lang.String,​java.lang.Object> responseHeaderParams)
      Update responseHeader params if and only if responseHeader already exists.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractResponse

        public AbstractResponse()
    • Method Detail

      • appendString

        public abstract void appendString​(java.lang.String name,
                                          java.lang.String value)
      • appendStringList

        public abstract void appendStringList​(java.lang.String name,
                                              java.util.List<java.lang.String> values)
      • appendMultiMap

        public abstract void appendMultiMap​(java.lang.String name,
                                            MultivaluedMap<java.lang.String,​java.lang.String> params)
      • getUnderlyingObject

        public abstract java.lang.Object getUnderlyingObject()
      • getQTime

        public abstract java.util.Optional<java.lang.Long> getQTime()
        Return Solr QTime
        Returns:
      • getTotalTime

        public abstract java.util.Optional<java.lang.Long> getTotalTime()
        Return Fusion Query Pipeline time
        Returns:
      • setTotalTime

        public abstract boolean setTotalTime​(java.lang.Long time)
        Set Fusion Query Pipeline time if and only if the responseHeader object already exists.
        Returns:
        true if update was successful
      • getNumFound

        public abstract java.util.Optional<java.lang.Long> getNumFound()
        Return Solr numFound
        Returns:
      • getMaxScore

        public abstract java.util.Optional<java.lang.Double> getMaxScore()
        Return Solr maxScore
        Returns:
      • setNumFound

        public abstract void setNumFound​(java.lang.Long numFound)
      • getStart

        public abstract java.util.Optional<java.lang.Long> getStart()
      • getCursorMark

        public abstract java.util.Optional<java.lang.String> getCursorMark()
      • setStart

        public abstract void setStart​(java.lang.Long start)
      • getResponseHeaderParams

        public abstract java.util.Map<java.lang.String,​java.lang.Object> getResponseHeaderParams()
        Get params in responseHeader Makes defensive copies, detached from underlying response object. Call updateResponseHeaderParams(Map) ()} to commit the changes to the actual underlying response object.
        Returns:
        responseHeader params
      • updateResponseHeaderParams

        public abstract boolean updateResponseHeaderParams​(java.util.Map<java.lang.String,​java.lang.Object> responseHeaderParams)
        Update responseHeader params if and only if responseHeader already exists.
        Returns:
        true if update was successful
      • getDocuments

        public java.util.List<ResponseDocument> getDocuments()
        Returns documents. Makes defensive copies, detached from underlying response object. Call updateDocuments(List) to commit the changes to the actual underlying response object.
        Returns:
        documents in Solr response
      • updateDocuments

        public void updateDocuments​(java.util.List<ResponseDocument> updatedDocuments)
        Update documents in underlying response object Use this method to commit changes (like reordering, redactions, rewritings) made to document objects returned from getDocuments()
        Parameters:
        updatedDocuments -
      • isGrouped

        public abstract 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
        Returns:
      • getGroupValues

        @Deprecated
        public abstract java.util.List<java.lang.String> getGroupValues()
        Deprecated.
        If group=true, return an ordered list of group values
        Returns:
      • getGroupValues

        public abstract java.util.List<java.lang.String> getGroupValues​(java.lang.String groupField)
        If group=true, return an ordered list of group values
        Parameters:
        groupField -
        Returns:
      • getDocumentsForGroupValue

        public java.util.List<ResponseDocument> getDocumentsForGroupValue​(java.lang.String groupField,
                                                                          java.lang.String groupValue)
        Returns documents (corresponding to groupValue) Makes defensive copies, detached from underlying response object. Call updateDocumentsForGroupValue(String, String, List) to commit the changes to the actual underlying response object.
        Parameters:
        groupField -
        groupValue -
        Returns:
      • getDocumentFieldValuesForGroupValue

        public abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getDocumentFieldValuesForGroupValue​(java.lang.String groupField,
                                                                                                                                   java.lang.String groupValue)
      • getDocumentFieldValuesForCollapseExpandGroupValue

        public abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getDocumentFieldValuesForCollapseExpandGroupValue​(java.lang.String groupField,
                                                                                                                                                 java.lang.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. Call updateDocumentFieldValuesForCollapseExpandGroupValue(String, String, List) to persist the changes to the actual underlying response object.
        Parameters:
        groupField -
        groupValue -
        Returns:
      • updateDocumentsForGroupValue

        @Deprecated
        public void updateDocumentsForGroupValue​(java.lang.String groupValue,
                                                 java.util.List<ResponseDocument> updatedDocuments)
        Update documents (corresponding to groupValue) in underlying response object
        Parameters:
        groupValue -
        updatedDocuments -
      • updateDocumentsForGroupValue

        public void updateDocumentsForGroupValue​(java.lang.String groupField,
                                                 java.lang.String groupValue,
                                                 java.util.List<ResponseDocument> updatedDocuments)
        Update documents (corresponding to groupValue) in underlying response object
        Parameters:
        groupField -
        groupValue -
        updatedDocuments -
      • updateDocumentFieldValuesForCollapseExpandGroupValue

        public abstract void updateDocumentFieldValuesForCollapseExpandGroupValue​(java.lang.String groupField,
                                                                                  java.lang.String groupValue,
                                                                                  java.util.List<java.util.Map<java.lang.String,​java.lang.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
        Parameters:
        groupField -
        groupValue -
        updatedDocuments -
      • updateDocumentFieldValuesForGroupValue

        public abstract void updateDocumentFieldValuesForGroupValue​(java.lang.String groupField,
                                                                    java.lang.String groupValue,
                                                                    java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> updatedDocuments)
      • getGroupedResults

        public abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.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
      • getExpandedResults

        public abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> getExpandedResults()
        Returns all collapse expanded results as a map of collapse field name to grouping data that includes list of docs
      • getGroups

        public abstract java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getGroups​(java.lang.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).
      • reorderGroupValues

        public abstract void reorderGroupValues​(java.lang.String groupField,
                                                java.util.List<java.lang.String> groupValues)
        Reorder group values in the response.
        Parameters:
        groupField - group field
        groupValues - a list of all group values in the desired order
      • getHighlighting

        public abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> getHighlighting()
        Return highlighting info as nested objects: {Doc ID -> Field name -> Snippets} Makes defensive copies, detached from underlying response object. Call updateHighlighting(Map) to commit the changes to the actual underlying response object.
        Returns:
      • updateHighlighting

        public abstract void updateHighlighting​(java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> highlighting)
        Update highlighting in underlying response object
        Parameters:
        highlighting -
      • getFacets

        public abstract java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.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. This is not ideal, but it would take a lot of work to support all the different variations of Solr responses that exist. At the time of this writing: - XMLResponse returns a LinkedHashMap - JSONResponse will return a List. The Java type of the list's contents will depend on what json.nl parameter was used in the Solr request. See https://lucene.apache.org/solr/guide/7_4/response-writers.html for complete list. We use Jackson to translate JSON -> Java types. Makes defensive copies, detached from underlying response object. Call updateFacets(Map) to commit the changes to the actual underlying response object.
        Returns:
      • getJsonFacets

        public abstract java.util.Map<java.lang.String,​java.lang.Object> getJsonFacets()
      • updateFacets

        public abstract void updateFacets​(java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.Object>> facets)
        Update facets in underlying response object
        Parameters:
        facets -
      • getSpellcheck

        public abstract java.util.Map<java.lang.String,​java.lang.Object> getSpellcheck()
        Returns response of Solr spellcheck handler
        Returns:
        spellcheck results or empty map
      • getDocIds

        public java.util.List<java.lang.String> getDocIds()
        Convenience method for returning all doc ids
        Returns:
      • getDocIds

        public abstract java.util.List<java.lang.String> getDocIds​(java.lang.String id)
      • toByteArray

        public byte[] toByteArray()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object