Contoso runs an online bike shop on an Azure Cosmos DB for NoSQL account that is enrolled in the Full Text & Hybrid Search for NoSQL API feature. The productSearch container has a full-text policy with defaultLanguage set to en-US and one full-text path, /searchText (en-US). The indexing policy has a full-text index on /searchText.
Each item's searchText value joins the product name and category name, for example Sport-100 Helmet, Red Accessories, Helmets.
A developer is writing the keyword queries for the shop's search box.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
| Statement | Yes | No |
|---|---|---|
To return products whose searchText contains either mountain or helmet, the developer should filter with FullTextContainsAll(c.searchText, "mountain", "helmet").FullTextContainsAll returns true only when every listed term is present, so it would return only items that contain both words. Matching either term calls for FullTextContainsAny, which needs at least one of the terms. | Correct | |
A query that filters with FullTextContains(c.searchText, "helmet") can return an item whose searchText contains the word Helmets but not the word Helmet.Full-text search applies stemming to the indexed text, which reduces terms to a common root. That is why a search for the singular helmet matches items that contain only the plural Helmets. | Correct | |
To tolerate search terms with up to three mistyped characters, the developer can pass a term object with distance set to 3 to FullTextContains.Fuzzy search accepts a distance of at most 2 edits, so a distance of 3 is not allowed. The developer could tolerate one or two edits only. | Correct |
The full-text contains functions differ in how many of the listed terms must be present: FullTextContainsAll needs all of them and FullTextContainsAny needs at least one. Full-text processing includes stemming, so a singular search term matches its plural form in the indexed text. Fuzzy matching is set with a term object whose distance can be at most two edits.