Skip to content

search_facets

search_facets(
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = None,
    locale: Optional[Locale] = None,
    search_text: Optional[SearchText] = None,
    filters: Optional[SearchFilterList] = None,
    facet_types: Optional[FacetTypeList] = None,
    next_token: Optional[NextToken] = None,
) -> SearchFacetsOutput

Retrieves the available facet values for filtering listings, such as categories, pricing models, fulfillment option types, publishers, and customer ratings. Each facet value includes a count of matching listings.

Parameters:

  • locale (Optional[Locale], default: None ) –

    The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See Locale for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.

  • search_text (Optional[SearchText], default: None ) –

    The search query text to filter listings before retrieving facets.

  • filters (Optional[SearchFilterList], default: None ) –

    Filters to apply before retrieving facets. A result must match every filter. Within one filter, a result matches if it has any of the values.

  • facet_types (Optional[FacetTypeList], default: None ) –

    The facet types to retrieve. If you omit this field or leave it empty, the service returns all available facets.

  • next_token (Optional[NextToken], default: None ) –

    If the service returns nextToken, more results are available. The value of nextToken is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a ValidationException.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action. Verify that you have the required permissions.

  • InternalServerException –

    Unexpected error during processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of your requests and retry.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. Check the reason field for the constraint that failed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Get facets for machine learning category Retrieve available facet values for listings in the machine learning category

>>> client.search_facets(locale='en-US', search_text='analytics', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}], facet_types=['FULFILLMENT_OPTION_TYPE', 'PRICING_MODEL'])
Get facets with term and rating range filters
Retrieve facets for security listings with ratings between 3.0 and 5.0 stars
>>> client.search_facets(locale='en-US', filters=[{'filterType': 'CATEGORY', 'filterValues': ['security']}, {'filterType': 'MIN_AVERAGE_CUSTOMER_RATING', 'filterValues': ['3.0']}, {'filterType': 'MAX_AVERAGE_CUSTOMER_RATING', 'filterValues': ['5.0']}], facet_types=['PRICING_MODEL', 'AVERAGE_CUSTOMER_RATING'])
Get specialization facets
Retrieve specialization and specialization category facets for listings that earned the Travel and Hospitality Services Competency
>>> client.search_facets(locale='en-US', filters=[{'filterType': 'SPECIALIZATION', 'filterValues': ['spec-0ae8wm2xxde76e']}], facet_types=['SPECIALIZATION', 'SPECIALIZATION_CATEGORY'])
Get certification facets
Retrieve certification values available for filtering
>>> client.search_facets(locale='en-US', facet_types=['CERTIFICATES'])
Get Trust Center availability facets
Retrieve Trust Center availability for filtering
>>> client.search_facets(locale='en-US', facet_types=['TRUST_CENTER'])
Source code in docs_src/capo_marketplace_discovery/_services/marketplace_discovery.py
def search_facets(
    self,
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = None,
    locale: Optional["capo_marketplace_discovery.types.locale.Locale"] = None,
    search_text: Optional[
        "capo_marketplace_discovery.types.search_text.SearchText"
    ] = None,
    filters: Optional[
        "capo_marketplace_discovery.types.search_filter_list.SearchFilterList"
    ] = None,
    facet_types: Optional[
        "capo_marketplace_discovery.types.facet_type_list.FacetTypeList"
    ] = None,
    next_token: Optional[
        "capo_marketplace_discovery.types.next_token.NextToken"
    ] = None,
) -> "capo_marketplace_discovery.types.search_facets_output.SearchFacetsOutput":
    """<p>Retrieves the available facet values for filtering listings, such as categories, pricing models, fulfillment option types, publishers, and customer ratings. Each facet value includes a count of matching listings.</p>

    Args:
        locale: <p>The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See <code>Locale</code> for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.</p>
        search_text: <p>The search query text to filter listings before retrieving facets.</p>
        filters: <p>Filters to apply before retrieving facets. A result must match every filter. Within one filter, a result matches if it has any of the values.</p>
        facet_types: <p>The facet types to retrieve. If you omit this field or leave it empty, the service returns all available facets.</p>
        next_token: <p>If the service returns <code>nextToken</code>, more results are available. The value of <code>nextToken</code> is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a <code>ValidationException</code>.</p>

    Raises:
        capo_marketplace_discovery.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action. Verify that you have the required permissions.</p>
        capo_marketplace_discovery.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of the request.</p>
        capo_marketplace_discovery.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and retry.</p>
        capo_marketplace_discovery.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service. Check the <code>reason</code> field for the constraint that failed.</p>
        capo_marketplace_discovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get facets for machine learning category
        Retrieve available facet values for listings in the machine learning category

        >>> client.search_facets(locale='en-US', search_text='analytics', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}], facet_types=['FULFILLMENT_OPTION_TYPE', 'PRICING_MODEL'])
        Get facets with term and rating range filters
        Retrieve facets for security listings with ratings between 3.0 and 5.0 stars

        >>> client.search_facets(locale='en-US', filters=[{'filterType': 'CATEGORY', 'filterValues': ['security']}, {'filterType': 'MIN_AVERAGE_CUSTOMER_RATING', 'filterValues': ['3.0']}, {'filterType': 'MAX_AVERAGE_CUSTOMER_RATING', 'filterValues': ['5.0']}], facet_types=['PRICING_MODEL', 'AVERAGE_CUSTOMER_RATING'])
        Get specialization facets
        Retrieve specialization and specialization category facets for listings that earned the Travel and Hospitality Services Competency

        >>> client.search_facets(locale='en-US', filters=[{'filterType': 'SPECIALIZATION', 'filterValues': ['spec-0ae8wm2xxde76e']}], facet_types=['SPECIALIZATION', 'SPECIALIZATION_CATEGORY'])
        Get certification facets
        Retrieve certification values available for filtering

        >>> client.search_facets(locale='en-US', facet_types=['CERTIFICATES'])
        Get Trust Center availability facets
        Retrieve Trust Center availability for filtering

        >>> client.search_facets(locale='en-US', facet_types=['TRUST_CENTER'])
    """

    def _handler(
        req: "OperationRequest[capo_marketplace_discovery.types.search_facets_input.SearchFacetsInput]",
    ) -> OperationResponse[
        "capo_marketplace_discovery.types.search_facets_output.SearchFacetsOutput"
    ]:
        import capo_marketplace_discovery._operations.aws_marketplace_discovery.search_facets

        output, http_response = (
            capo_marketplace_discovery._operations.aws_marketplace_discovery.search_facets.search_facets(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchFacets")
    )
    input_: capo_marketplace_discovery.types.search_facets_input.SearchFacetsInput = {}
    if locale is not None:
        input_["locale"] = locale
    if search_text is not None:
        input_["search_text"] = search_text
    if filters is not None:
        input_["filters"] = filters
    if facet_types is not None:
        input_["facet_types"] = facet_types
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output