Package stroom.query.common.v2
Class SearchResponseCreator
- java.lang.Object
-
- stroom.query.common.v2.SearchResponseCreator
-
public class SearchResponseCreator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SearchResponseCreator(Store store)SearchResponseCreator(Store store, java.time.Duration defaultTimeout)
-
Method Summary
Modifier and Type Method Description SearchResponsecreate(SearchRequest searchRequest)Build aSearchResponsefrom the passedSearchRequest.static SearchResponsecreateErrorResponse(java.util.List<java.lang.String> errorMessages)voiddestroy()Stop searching and destroy any stored data.
-
-
-
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 aSearchResponsefrom the passedSearchRequest.- Parameters:
searchRequest- TheSearchRequestcontaining the query terms and the result requests- Returns:
- A
SearchResponseobject that may be one of:- A 'complete'
SearchResponsecontaining all the data requested - An incomplete
SearchResponsecontaining 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
- A 'complete'
-
createErrorResponse
public static SearchResponse createErrorResponse(java.util.List<java.lang.String> errorMessages)
- Parameters:
errorMessages- List of errors to add to theSearchResponse- Returns:
- An empty
SearchResponsewith the passed error messages
-
-