AI-102 exam dumps

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

Single answer

You are designing a solution using Azure Cognitive Search. Your application needs to query an index to retrieve documents where the 'category' field is 'Technology', the 'rating' field is greater than 4, and the results should be sorted by the 'datePublished' field in descending order. Which query syntax should you use to fulfill this requirement?

  1. A

    search=*&$filter=category eq 'Technology' and rating gt 4&$orderby=datePublished desc

  2. B

    search=*&$filter=category eq 'Technology' or rating gt 4&$orderby=datePublished asc

  3. C

    search=*&$filter=category ne 'Technology' and rating lt 4&$orderby=datePublished desc

  4. D

    search=Technology&$filter=rating gt 4&$orderby=datePublished desc

Show answer and explanation

Correct answer: A

Explanation

To query an Azure Cognitive Search index effectively, you need to use the correct syntax for filtering, sorting, and searching. The 'search=*' performs a wildcard search across all documents, the '$filter' parameter applies specific conditions to the fields, and '$orderby' determines the sorting order. The correct query combines these elements to meet the specified requirements.

  • A. Correct.

    This is the correct syntax. It uses the 'search=*' to query all documents, applies a filter to include only documents where 'category' equals 'Technology' and 'rating' is greater than 4, and sorts the results by 'datePublished' in descending order.

  • B. Incorrect.

    This syntax is incorrect because it uses 'or' instead of 'and' in the filter, which would include documents where either condition is true, not both. Additionally, the sorting is in ascending order, which does not meet the requirement.

  • C. Incorrect.

    This syntax is incorrect because it applies a filter to exclude documents where 'category' equals 'Technology' and includes only those with a 'rating' less than 4, which contradicts the requirement.

  • D. Incorrect.

    This syntax is incorrect because the 'search' term is set to 'Technology', which limits the search to documents containing the word 'Technology' in the full-text search fields, rather than filtering on the 'category' field.

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