getSearchResults method
Retrieves the ranked results of a search, ordered by descending relevance
score. Results are available only after the search has reached the
SUCCEEDED status. Calling this on a search that exists but
has not yet completed returns InvalidRequestException, while
calling it on a search that does not exist returns
ResourceNotFoundException. The response is paginated: when
nextToken is present, pass it on a subsequent call to
retrieve the next page.
May throw AccessDeniedException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter searchId :
The identifier of the search whose results are retrieved.
Parameter workspaceName :
The name of the workspace the search belongs to.
Parameter maxResults :
The maximum number of results to return in a single page. Valid range is 1
to 10,000; if omitted, a service-defined default is used.
Parameter nextToken :
The pagination token returned by a previous GetSearchResults call. Provide
it to retrieve the next page of results; omit it to retrieve the first
page.
Implementation
Future<GetSearchResultsResponse> getSearchResults({
required String searchId,
required String workspaceName,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
10000,
);
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/workspaces/${Uri.encodeComponent(workspaceName)}/searches/${Uri.encodeComponent(searchId)}/results',
queryParams: $query,
hostPrefix: 'data.',
exceptionFnMap: _exceptionFns,
);
return GetSearchResultsResponse.fromJson(response);
}