QBusiness / Client / search_relevant_content
search_relevant_content#
- QBusiness.Client.search_relevant_content(**kwargs)#
Searches for relevant content in a Q Business application based on a query. This operation takes a search query text, the 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.
See also: AWS API Documentation
Request Syntax
response = client.search_relevant_content( applicationId='string', queryText='string', contentSource={ 'retriever': { 'retrieverId': 'string' } }, attributeFilter={ 'andAllFilters': [ {'... recursive ...'}, ], 'orAllFilters': [ {'... recursive ...'}, ], 'notFilter': {'... recursive ...'}, 'equalsTo': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'containsAll': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'containsAny': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'greaterThan': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'greaterThanOrEquals': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'lessThan': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, 'lessThanOrEquals': { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } } }, maxResults=123, nextToken='string' )
- Parameters:
applicationId (string) –
[REQUIRED]
The unique identifier of the Q Business application to search.
queryText (string) –
[REQUIRED]
The text to search for.
contentSource (dict) –
[REQUIRED]
The source of content to search in.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
retriever
.retriever (dict) –
The retriever to use as the content source.
retrieverId (string) – [REQUIRED]
The unique identifier of the retriever to use as the content source.
attributeFilter (dict) –
Enables filtering of responses based on document attributes or metadata fields.
andAllFilters (list) –
Performs a logical
AND
operation on all supplied filters.(dict) –
Enables filtering of responses based on document attributes or metadata fields.
orAllFilters (list) –
Performs a logical
OR
operation on all supplied filters.(dict) –
Enables filtering of responses based on document attributes or metadata fields.
notFilter (dict) –
Performs a logical
NOT
operation on all supplied filters.equalsTo (dict) –
Performs an equals operation on two document attributes or metadata fields. Supported for the following document attribute value types:
dateValue
,longValue
,stringListValue
andstringValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
containsAll (dict) –
Returns
true
when a document contains all the specified document attributes or metadata fields. Supported for the following document attribute value types:stringListValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
containsAny (dict) –
Returns
true
when a document contains any of the specified document attributes or metadata fields. Supported for the following document attribute value types:stringListValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
greaterThan (dict) –
Performs a greater than operation on two document attributes or metadata fields. Supported for the following document attribute value types:
dateValue
andlongValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
greaterThanOrEquals (dict) –
Performs a greater or equals than operation on two document attributes or metadata fields. Supported for the following document attribute value types:
dateValue
andlongValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
lessThan (dict) –
Performs a less than operation on two document attributes or metadata fields. Supported for the following document attribute value types:
dateValue
andlongValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
lessThanOrEquals (dict) –
Performs a less than or equals operation on two document attributes or metadata fields.Supported for the following document attribute value type:
dateValue
andlongValue
.name (string) – [REQUIRED]
The identifier for the attribute.
value (dict) – [REQUIRED]
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
stringValue
,stringListValue
,longValue
,dateValue
.stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
maxResults (integer) – The maximum number of results to return.
nextToken (string) – The token for the next set of results. (You received this token from a previous call.)
- Return type:
dict
- Returns:
Response Syntax
{ 'relevantContent': [ { 'content': 'string', 'documentId': 'string', 'documentTitle': 'string', 'documentUri': 'string', 'documentAttributes': [ { 'name': 'string', 'value': { 'stringValue': 'string', 'stringListValue': [ 'string', ], 'longValue': 123, 'dateValue': datetime(2015, 1, 1) } }, ], 'scoreAttributes': { 'scoreConfidence': 'VERY_HIGH'|'HIGH'|'MEDIUM'|'LOW'|'NOT_AVAILABLE' } }, ], 'nextToken': 'string' }
Response Structure
(dict) –
relevantContent (list) –
The list of relevant content items found.
(dict) –
Represents a piece of content that is relevant to a search query.
content (string) –
The actual content of the relevant item.
documentId (string) –
The unique identifier of the document containing the relevant content.
documentTitle (string) –
The title of the document containing the relevant content.
documentUri (string) –
The URI of the document containing the relevant content.
documentAttributes (list) –
Additional attributes of the document containing the relevant content.
(dict) –
A document attribute or metadata field.
name (string) –
The identifier for the attribute.
value (dict) –
The value of the attribute.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
stringValue
,stringListValue
,longValue
,dateValue
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
stringValue (string) –
A string.
stringListValue (list) –
A list of strings.
(string) –
longValue (integer) –
A long integer value.
dateValue (datetime) –
A date expressed as an ISO 8601 string.
It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.
scoreAttributes (dict) –
Attributes related to the relevance score of the content.
scoreConfidence (string) –
The confidence level of the relevance score.
nextToken (string) –
The token to use to retrieve the next set of results, if there are any.
Exceptions
QBusiness.Client.exceptions.ResourceNotFoundException
QBusiness.Client.exceptions.InternalServerException
QBusiness.Client.exceptions.LicenseNotFoundException
QBusiness.Client.exceptions.ThrottlingException
QBusiness.Client.exceptions.ValidationException
QBusiness.Client.exceptions.AccessDeniedException