AI-102 exam dumps

AI-102 practice question 383 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 383

Single answer

You are designing an Azure AI solution and need to query an Azure Cognitive Search index to retrieve documents that contain the phrase 'machine learning' in the title field. Additionally, you want to filter results to include only those published after '2022-01-01' and sorted by the 'popularity' field in descending order. Which query syntax should you use?

  1. A

    search=title:'machine learning'&$filter=publishedDate gt 2022-01-01&$orderby=popularity desc

  2. B

    search=title:"machine learning"&$filter=publishedDate gt '2022-01-01'&$orderby=popularity desc

  3. C

    search=title='machine learning'&filter=publishedDate > 2022-01-01&orderby=popularity descending

  4. D

    search="machine learning"&$filter=publishedDate gt '2022-01-01'&orderby=popularity desc

Show answer and explanation

Correct answer: B

Explanation

In Azure Cognitive Search, specific syntax rules must be followed for querying indexes. For phrase searches, double quotes are used. Filtering requires the use of operators like 'gt' and dates must be enclosed in single quotes. Sorting requires the '$orderby' directive followed by the field name and order ('asc' or 'desc'). Option 2 strictly adheres to these rules, making it the correct answer.

  • A. Incorrect.

    This syntax uses incorrect quotes around the phrase 'machine learning' and omits proper single quotes for the date string in the filter.

  • B. Correct.

    This is the correct syntax. Double quotes are used for exact phrase matching in Cognitive Search. The filter correctly uses the 'gt' operator and wraps the date in single quotes. The orderby clause is correctly specified as 'popularity desc'.

  • C. Incorrect.

    This syntax incorrectly uses '=' instead of ':' for field-value matching and does not use the required single quotes for the date string.

  • D. Incorrect.

    This syntax incorrectly uses '=' instead of ':' for field-value matching in the search query and omits the '$' prefix in the orderby clause.

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