searchRelevantContent method

Future<SearchRelevantContentResponse> searchRelevantContent({
  1. required String applicationId,
  2. required ContentSource contentSource,
  3. required String queryText,
  4. AttributeFilter? attributeFilter,
  5. int? maxResults,
  6. String? nextToken,
})

Searches for relevant content in a Amazon Q Business application based on a query. This operation takes a search query text, the Amazon Q Business application identifier, and optional filters (such as content source and maximum results) as input. It returns a list of relevant content items, where each item includes the content text, the unique document identifier, the document title, the document URI, any relevant document attributes, and score attributes indicating the confidence level of the relevance.

May throw AccessDeniedException. May throw InternalServerException. May throw LicenseNotFoundException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter applicationId : The unique identifier of the Amazon Q Business application to search.

Parameter contentSource : The source of content to search in.

Parameter queryText : The text to search for.

Parameter maxResults : The maximum number of results to return.

Parameter nextToken : The token for the next set of results. (You received this token from a previous call.)

Implementation

Future<SearchRelevantContentResponse> searchRelevantContent({
  required String applicationId,
  required ContentSource contentSource,
  required String queryText,
  AttributeFilter? attributeFilter,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    'contentSource': contentSource,
    'queryText': queryText,
    if (attributeFilter != null) 'attributeFilter': attributeFilter,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/relevant-content',
    exceptionFnMap: _exceptionFns,
  );
  return SearchRelevantContentResponse.fromJson(response);
}