Struggling with Azure AI Search query syntax for the AI-102 exam? Learn why “condo + wifi” requires both terms (searchMode=all) while “condo – wifi” uses logical OR exclusion (searchMode=any). Get exam-ready with detailed operator explanations and scenario-based solutions.
Table of Contents
Question
Xerigon Corporation is a broker for vacation rentals. The company uses Azure AI Search. You create the following queries:
Query 1:
POST https://xerigonsearch1.search.windows.net/indexes/vaction-rentals/docs/search?api-version=2024-07-01
{
“queryType”: “simple”,
“search”: “condo + wifi”,
“searchMode”: “all”
}
Query 2:
POST https://xerigonsearch1.search.windows.net/indexes/vaction-rentals/docs/search?api-version=2024-07-01
{
“queryType”: “simple”,
“search”: “condo – wifi”,
“searchMode”: “any”
}
Which of the following statements are TRUE regarding the queries? (Choose two.)
A. Query 1 will return documents that either contain condo or those that do not contain wifi.
B. Query 2 will return documents that either contain condo or those that do not contain wifi.
C. Query 2 will return documents that contain either condo or wifi.
D. Query 2 will return documents that contain condo and all documents that do not contain wifi.
E. Query 1 will return documents that contain condo and all documents that do not contain wifi.
F. Query 1 will return documents that contain both condo and wifi.
G. Query 2 will return documents that contain both condo and wifi.
H. Query 1 will return documents that contain either condo or wifi.
Answer
B. Query 2 will return documents that either contain condo or those that do not contain wifi.
F. Query 1 will return documents that contain both condo and wifi.
Explanation
You would choose the following:
- Query 1 will return documents that contain both condo and wifi.
- Query 2 will return documents that either contain condo or those that do not contain wifi.
With a simple query, you can specify the characters +, |, and -. You can also change the searchMode parameter.
Character | Example | Usage |
---|---|---|
+ | condo + wifi | An AND operation. For example, condo + wifi specifies that a document must contain both terms. |
| | condo | wifi | An OR operation retrieves a match when either term is found. In the example, the query engine will return a match on documents containing either condo or wifi or both. Because OR is the default operator, you could also omit it, such that condo wifi is the same as condo | wifi. |
– | condo – wifi | A NOT operation that retrieves matches on documents that contain condo but exclude wifi. |
The NOT operation (-) is affected by the searchMode parameter. When the searchMode parameter has a value of any instead of all, then the search will return more documents because “searchMode”: “any” will be interpreted as “OR NOT”. In Query 2, “search”: “condo – wifi” will retrieve documents that either contain the term condo or those that do not contain the term wifi.
When you specify “searchMode”: “all”, then searchMode is interpreted as “AND NOT”. For example, with “searchMode”: “all”, the query “search”: “condo – wifi” will retrieve documents that contain the term condo and all documents that do not contain the term wifi.
Query 1 uses the query “search”: “condo + wifi” which returns documents containing both terms. The value of the “searchMode” parameter is not affected by the AND (+) operation.
Query 2 will not return documents that contain condo and all documents that do not contain wifi. Since the searchMode parameter is set to any, the operation is interpreted as “OR NOT” instead of “AND NOT”.
Microsoft Azure AI Engineer Associate AI-102 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Microsoft Azure AI Engineer Associate AI-102 exam and earn Microsoft Azure AI Engineer Associate AI-102 certification.