searchIndex method
The query search index.
May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException. May throw ResourceNotFoundException. May throw InvalidQueryException. May throw IndexNotReadyException.
Parameter queryString
:
The search query string.
Parameter indexName
:
The search index name.
Parameter maxResults
:
The maximum number of results to return at one time.
Parameter nextToken
:
The token used to get the next set of results, or null
if
there are no additional results.
Parameter queryVersion
:
The query version.
Implementation
Future<SearchIndexResponse> searchIndex({
required String queryString,
String? indexName,
int? maxResults,
String? nextToken,
String? queryVersion,
}) async {
ArgumentError.checkNotNull(queryString, 'queryString');
_s.validateStringLength(
'queryString',
queryString,
1,
1152921504606846976,
isRequired: true,
);
_s.validateStringLength(
'indexName',
indexName,
1,
128,
);
_s.validateNumRange(
'maxResults',
maxResults,
1,
500,
);
final $payload = <String, dynamic>{
'queryString': queryString,
if (indexName != null) 'indexName': indexName,
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
if (queryVersion != null) 'queryVersion': queryVersion,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/indices/search',
exceptionFnMap: _exceptionFns,
);
return SearchIndexResponse.fromJson(response);
}