Class QueryResponse

  • All Implemented Interfaces:
    PlatformMessage, java.io.Serializable, java.lang.Cloneable

    public class QueryResponse
    extends AbstractPlatformMessage
    implements java.io.Serializable
    QueryResponse contains the response to a QueryRequest.

    The response may contain any of the following based on the initial request:

    • The QueryRequest after modifications by all query request/response transformers. NOTE: this should NOT be reused.
    • The documents that matched the query inside a SearchDocumentList
    • The facet results if any were requested.
    • Any query feedback generated by query/response transformers. These could contain spelling suggestions, or information messages about any processing that took place.
    • Basic timing information about how long various part of the search took.
    See Also:
    Serialized Form
    • Field Detail

      • SPELLCHECK_SUGGESTED

        public static final java.lang.String SPELLCHECK_SUGGESTED
        The response property containing the spellcheck suggested query
        See Also:
        Constant Field Values
      • SPELLCHECK_SUGGESTED_MARKEDUP

        public static final java.lang.String SPELLCHECK_SUGGESTED_MARKEDUP
        The response property containing the marked up spellcheck suggested query
        See Also:
        Constant Field Values
      • TERMCOUNTCHECK_REPORT

        public static final java.lang.String TERMCOUNTCHECK_REPORT
        The response property containing the term count check report
        See Also:
        Constant Field Values
      • STATISTICS_QUERY_INFO

        public static final java.lang.String STATISTICS_QUERY_INFO
        The response property containing the query statistics
        See Also:
        Constant Field Values
      • STATISTICS_LINGUISTICS_INFO

        public static final java.lang.String STATISTICS_LINGUISTICS_INFO
        The response property containing the query linguistics info
        See Also:
        Constant Field Values
    • Constructor Detail

      • QueryResponse

        protected QueryResponse()
      • QueryResponse

        public QueryResponse​(QueryRequest request)
        Creates a new QueryResponse from a QueryRequest object.

        Any workflows set on request are transferred to the new query response, that is they do not remain on request.

      • QueryResponse

        public QueryResponse​(java.util.UUID clientId,
                             WorkflowQueue workflows)
    • Method Detail

      • getSchemaName

        public java.lang.String getSchemaName()
        Get the schema name specified for the request.
      • getTotalRows

        public long getTotalRows()
        Gets the total number of rows that matched the query.
      • getDocuments

        public SearchDocumentList getDocuments()
        Get the documents returned for this response.

        NOTE: this will only contain a "window" over the total result set based on the requested number of rows and offset requested.

      • setDocuments

        public void setDocuments​(SearchDocumentList value)
        Set the documents to return with this repsonse.
      • getQueryRequest

        public QueryRequest getQueryRequest()
        Get the QueryRequest for this response.

        NOTE: this may be null in order to optimize network traffic.

      • getWorkflowTime

        public long getWorkflowTime()
        Get the number of milliseconds spent in workflow stages.

        This is the total time spent during workflow processing. This included search time/facet time/response time.

      • setWorkflowTime

        public void setWorkflowTime​(long time)
        Set the number of milliseconds spent in workflow stages.
      • getResponseTime

        public long getResponseTime()
        The total time spent processing a request including network and serialization time in milliseconds.
      • getSearchTime

        public long getSearchTime()
        Get the number of milliseconds taken to execute the search.

        This time only takes into account the time spent matching and ordering results.

      • setSearchTime

        public void setSearchTime​(long time)
        Set the number of milliseconds taken to execute the search.
      • getFacetTime

        public long getFacetTime()
        Get the number of milliseconds taken to compute facets.
      • setFacetTime

        public void setFacetTime​(long time)
        Set the number of milliseconds taken to compute facets.
      • getResultTime

        public long getResultTime()
        Get the number of milliseconds taken to generate results.

        This is the time taken to create the SearchDocuments for the response.

      • setResultTime

        public void setResultTime​(long time)
        Set the number of milliseconds taken to generate results.
      • getHighlightTime

        public long getHighlightTime()
        Get the number of milliseconds taken to highlight results.

        NOTE: this is the total CPU time spent during highlighting. This may be greater than the wall clock time in the case of multi-column installations.

      • setHighlightTime

        public void setHighlightTime​(long time)
        Set the number of milliseconds taken to highlight results.
      • getQueryTimestamp

        public long getQueryTimestamp()
        Get the timestamp the query was received
        Returns:
        timestamp
      • setQueryTimestamp

        public void setQueryTimestamp​(long queryTime)
        Set the timestamp the query was received
      • getFacets

        public java.util.List<FacetResponse> getFacets()
        Get the generated facets for this response.

        NOTE: this method will never return null.

      • getFacet

        public FacetResponse getFacet​(java.lang.String name)
        Gets a facet by name.
        Returns:
        a facet response, or null if the facet is not found
      • setFacets

        public void setFacets​(java.util.List<FacetResponse> value)
        Set the generated facets for this response.
      • setFacets

        public void setFacets​(FacetResponse... value)
        Set the generated facets for this response.
      • addFacet

        public void addFacet​(FacetResponse value)
        Add a facet to the response.
      • getPlacements

        public java.util.List<QueryPlacement> getPlacements()
        Get all placements for this response.
      • setPlacements

        public void setPlacements​(java.util.List<QueryPlacement> value)
      • getFeedback

        public java.util.List<QueryFeedback> getFeedback()
        Get all feedback messages for this response.
      • setFeedback

        public void setFeedback​(java.util.List<QueryFeedback> value)
      • getFeedbackByMessageName

        public java.util.List<QueryFeedback> getFeedbackByMessageName​(java.lang.String messageName)
        Get all query feedback that has a message specific message name.
      • addFeedback

        public void addFeedback​(java.util.List<QueryFeedback> value)
        Add multiple feedback messages.
      • addFeedback

        public void addFeedback​(QueryFeedback... value)
        Add multiple feedback messages.
      • addFeedback

        public QueryFeedback addFeedback​(java.lang.String stageName,
                                         java.lang.String messageName,
                                         java.lang.String message)
        Add a feedback message.
      • addFeedback

        public QueryFeedback addFeedback​(java.lang.String stageName,
                                         java.lang.String messageName,
                                         java.lang.String message,
                                         java.util.Map<java.lang.String,​java.lang.Object> properties)
        Add a feedback message.
      • toString

        protected java.lang.StringBuilder toString​(java.lang.StringBuilder buffer)
        Append the string form of this request to buffer.
        Overrides:
        toString in class AbstractPlatformMessage