rescore method

Future<RescoreResult> rescore({
  1. required List<Document> documents,
  2. required String rescoreExecutionPlanId,
  3. required String searchQuery,
})

Rescores or re-ranks search results from a search service such as OpenSearch (self managed). You use the semantic search capabilities of Amazon Kendra Intelligent Ranking to improve the search service's results.

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

Parameter documents : The list of documents for Amazon Kendra Intelligent Ranking to rescore or rank on.

Parameter rescoreExecutionPlanId : The identifier of the rescore execution plan. A rescore execution plan is an Amazon Kendra Intelligent Ranking resource used for provisioning the Rescore API.

Parameter searchQuery : The input query from the search service.

Implementation

Future<RescoreResult> rescore({
  required List<Document> documents,
  required String rescoreExecutionPlanId,
  required String searchQuery,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSKendraRerankingFrontendService.Rescore'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Documents': documents,
      'RescoreExecutionPlanId': rescoreExecutionPlanId,
      'SearchQuery': searchQuery,
    },
  );

  return RescoreResult.fromJson(jsonResponse.body);
}