Class SearchResponseCreator


  • public class SearchResponseCreator
    extends java.lang.Object
    • Constructor Detail

      • SearchResponseCreator

        public SearchResponseCreator​(Store store)
        Parameters:
        store - The underlying store to use for creating the search responses.
      • SearchResponseCreator

        public SearchResponseCreator​(Store store,
                                     java.time.Duration defaultTimeout)
        Parameters:
        store - The underlying store to use for creating the search responses.
        defaultTimeout - The service's default timeout period to use for waiting for the store to complete. This will be used when the search request hasn't specified a timeout period.
    • Method Detail

      • destroy

        public void destroy()
        Stop searching and destroy any stored data.
      • create

        public SearchResponse create​(SearchRequest searchRequest)
        Build a SearchResponse from the passed SearchRequest.
        Parameters:
        searchRequest - The SearchRequest containing the query terms and the result requests
        Returns:
        A SearchResponse object that may be one of:
        • A 'complete' SearchResponse containing all the data requested
        • An incomplete SearchResponse containing none, some or all of the data requested, i.e the currently know results at the point the request is made.
        • An empty response with an error message indicating the request timed out waiting for a 'complete' result set. This only applies to non-incremental queries.
        • An empty response with a different error message. This will happen when some unexpected error has occurred while assembling the SearchResponse
      • createErrorResponse

        public static SearchResponse createErrorResponse​(java.util.List<java.lang.String> errorMessages)
        Parameters:
        errorMessages - List of errors to add to the SearchResponse
        Returns:
        An empty SearchResponse with the passed error messages