Class SearchRequest

  • All Implemented Interfaces:
    java.io.Serializable

    public final class SearchRequest
    extends java.lang.Object
    implements java.io.Serializable
    A class for describing a search request including the query to run and definition(s) of how the results should be returned
    See Also:
    Serialized Form
    • Constructor Detail

      • SearchRequest

        public SearchRequest()
      • SearchRequest

        public SearchRequest​(QueryKey key,
                             Query query,
                             java.util.List<ResultRequest> resultRequests,
                             java.lang.String dateTimeLocale,
                             java.lang.Boolean incremental,
                             java.lang.Long timeout)
        Parameters:
        key - A unique key to identify the instance of the search by. This key is used to identify multiple requests for the same search when running in incremental mode.
        query - The query terms for the search
        resultRequests - A list of resultRequest definitions. If null or the list is empty no results will be returned. Allows the caller to request that the results of the query are returned in multiple forms, e.g. using a number of different filtering/aggregation/sorting approaches.
        dateTimeLocale - The locale to use when formatting date values in the search results. The value is the string form of a zoneId
        incremental - If true the response will contain all results found so far. Future requests for the same query key may return more results. Intended for use on longer running searches to allow partial result sets to be returned as soon as they are available rather than waiting for the full result set.
        timeout - Set the maximum time (in ms) for the server to wait for a complete result set. The timeout applies to both incremental and non incremental queries, though the behaviour is slightly different. The timeout will make the server wait for which ever comes first out of the query completing or the timeout period being reached. If no value is supplied then for an incremental query a default value of 0 will be used (i.e. returning immediately) and for a non-incremental query the server's default timeout period will be used. For an incremental query, if the query has not completed by the end of the timeout period, it will return the currently know results with complete=false, however for a non-incremental query it will return no results, complete=false and details of the timeout in the error field
    • Method Detail

      • getKey

        public QueryKey getKey()
        Returns:
        The unique queryKey for the search request
      • setKey

        public void setKey​(QueryKey key)
      • getQuery

        public Query getQuery()
        Returns:
        The query object containing the search terms
      • setQuery

        public void setQuery​(Query query)
      • setResultRequests

        public void setResultRequests​(java.util.List<ResultRequest> resultRequests)
      • getDateTimeLocale

        public java.lang.String getDateTimeLocale()
        Returns:
        The locale ID, see ZoneId, for the date values uses in the search response.
      • setDateTimeLocale

        public void setDateTimeLocale​(java.lang.String dateTimeLocale)
      • getIncremental

        public java.lang.Boolean getIncremental()
        Returns:
        Whether the search should return immediately with the results found so far or wait for the search to finish
      • setIncremental

        public void setIncremental​(java.lang.Boolean incremental)
      • getTimeout

        public java.lang.Long getTimeout()
        Returns:
        The timeout period in ms. Can be null.
      • setTimeout

        public void setTimeout​(java.lang.Long timeout)
      • incremental

        public boolean incremental()
        Returns:
        Whether the search should return immediately with the results found so far or wait for the search to finish
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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