AI-102 exam dumps

AI-102 practice question 381 of 493

Designing and Implementing a Microsoft Azure AI Solution. Professional level, Microsoft. Free question with the correct answer and a full explanation.

AI-102 Question 381

Single answer

You are designing a search solution using Azure Cognitive Search for an e-commerce platform to allow customers to query product data. The platform requires functionality for sorting by price, filtering by a specific category, and supporting wildcard searches in the product name. Which of the following queries would correctly implement these requirements?

  1. A

    search=productName:Phone&$orderby=price asc&$filter=category eq 'Electronics'

  2. B

    search=productName eq 'Phone'&$orderby=price asc&$filter=category eq 'Electronics'

  3. C

    search=Phone&$orderby=price desc&$filter=category in ('Electronics', 'Appliances')

  4. D

    search=productName:Phone*&$orderby=price asc&$filter=category eq 'Electronics'

Show answer and explanation

Correct answer: A

Explanation

The correct query syntax for Azure Cognitive Search must align with its supported parameters and operators. Wildcard searches should use the search parameter with * as the wildcard character. Sorting is performed using $orderby, and filtering is achieved through $filter with proper logical operators. Option 1 satisfies all these requirements correctly.

  • A. Correct.

    This query uses the correct syntax for a wildcard search (*Phone*), sorting ($orderby=price asc), and filtering ($filter=category eq 'Electronics'). It meets all the requirements.

  • B. Incorrect.

    This query incorrectly uses productName eq '*Phone*' for the wildcard search, which is not valid Azure Cognitive Search syntax. Wildcard searches should use the search parameter, not equality checks.

  • C. Incorrect.

    This query uses search=*Phone* for the wildcard search, which is valid, but the $orderby value specifies descending order (desc) instead of ascending order as required. Additionally, the $filter clause specifies multiple categories instead of a specific one.

  • D. Incorrect.

    This query uses an invalid syntax for the wildcard search (productName:Phone*). Azure Cognitive Search does not support this format; it uses the search parameter for such queries.

Timed practice exam

Take a AI-102 practice test under exam conditions

40 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam