createFeaturedResultsSet method
Creates a set of featured results to display at the top of the search results page. Featured results are placed above all other results for certain queries. You map specific queries to specific documents for featuring in the results. If a query contains an exact match, then one or more specific documents are featured in the search results.
You can create up to 50 sets of featured results per index. You can request to increase this limit by contacting Support.
May throw AccessDeniedException.
May throw ConflictException.
May throw FeaturedResultsConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter featuredResultsSetName :
A name for the set of featured results.
Parameter indexId :
The identifier of the index that you want to use for featuring results.
Parameter clientToken :
A token that you provide to identify the request to create a set of
featured results. Multiple calls to the
CreateFeaturedResultsSet API with the same client token will
create only one featured results set.
Parameter description :
A description for the set of featured results.
Parameter featuredDocuments :
A list of document IDs for the documents you want to feature at the top of
the search results page. For more information on the list of documents,
see FeaturedResultsSet.
Parameter queryTexts :
A list of queries for featuring results. For more information on the list
of queries, see FeaturedResultsSet.
Parameter status :
The current status of the set of featured results. When the value is
ACTIVE, featured results are ready for use. You can still
configure your settings before setting the status to ACTIVE.
You can set the status to ACTIVE or INACTIVE
using the UpdateFeaturedResultsSet
API. The queries you specify for featured results must be unique per
featured results set for each index, whether the status is
ACTIVE or INACTIVE.
Parameter tags :
A list of key-value pairs that identify or categorize the featured results
set. You can also use tags to help control access to the featured results
set. Tag keys and values can consist of Unicode letters, digits, white
space, and any of the following symbols:_ . : / = + - @.
Implementation
Future<CreateFeaturedResultsSetResponse> createFeaturedResultsSet({
required String featuredResultsSetName,
required String indexId,
String? clientToken,
String? description,
List<FeaturedDocument>? featuredDocuments,
List<String>? queryTexts,
FeaturedResultsSetStatus? status,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSKendraFrontendService.CreateFeaturedResultsSet'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'FeaturedResultsSetName': featuredResultsSetName,
'IndexId': indexId,
if (clientToken != null) 'ClientToken': clientToken,
if (description != null) 'Description': description,
if (featuredDocuments != null) 'FeaturedDocuments': featuredDocuments,
if (queryTexts != null) 'QueryTexts': queryTexts,
if (status != null) 'Status': status.value,
if (tags != null) 'Tags': tags,
},
);
return CreateFeaturedResultsSetResponse.fromJson(jsonResponse.body);
}