AI-102 Question 360
Select 3You are designing a search solution for a retail website that uses Azure Cognitive Search. You need to create an index for storing product data, which includes fields for ProductID (string), Name (string), Description (string), Price (double), and Availability (boolean). The solution must support filtering for products based on availability and sorting by price. Which steps are required to define the index schema in Azure Cognitive Search to meet these requirements?
- A
Set the 'ProductID' field as the key field.
- B
Mark the 'Availability' field as filterable.
- C
Define the 'Price' field as sortable.
- D
Set the 'Description' field as the key field.
- E
Mark the 'Name' field as retrievable only.
Show answer and explanation
Correct answers: A, B, C
Explanation
To meet the requirements of the scenario, you must define an index schema that includes a key field ('ProductID') for uniquely identifying documents, mark the 'Availability' field as filterable to allow filtering by availability, and define the 'Price' field as sortable to enable sorting by price. These features ensure the index meets the functional requirements for filtering and sorting in the retail website's search solution.
- A. Correct.
Setting the 'ProductID' field as the key field is mandatory because every index in Azure Cognitive Search requires a key field, which uniquely identifies each document.
- B. Correct.
Marking the 'Availability' field as filterable allows you to filter search results based on whether a product is available or not, which is a requirement of the scenario.
- C. Correct.
Defining the 'Price' field as sortable ensures that search results can be ordered by price, as per the scenario's requirements.
- D. Incorrect.
The key field must be a field that uniquely identifies each document, and 'Description' is not suitable for this purpose.
- E. Incorrect.
Marking the 'Name' field as retrievable only is not necessary for this scenario, as the question does not mention restricting fields to retrievable-only access.