Skip to content

Commit 3510557

Browse files
Merge pull request #5972 from HeidiSteen/heidist-july
[azure search] Test examples for ismatch function and refresh query reference doc
2 parents 09fd094 + ca436c7 commit 3510557

File tree

2 files changed

+210
-29
lines changed

2 files changed

+210
-29
lines changed

articles/search/search-modeling-multitenant-saas-applications.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ In the case of a multitenant scenario, the application developer consumes one or
8080

8181
In an index-per-tenant model, multiple tenants occupy a single Azure AI Search service where each tenant has their own index.
8282

83-
Tenants achieve data isolation because all search requests and document operations are issued at an index level in Azure AI Search. In the application layer, there's the need awareness to direct the various tenants’ traffic to the proper indexes while also managing resources at the service level across all tenants.
83+
This approach works because all search requests and document operations are issued at an index level in Azure AI Search. In the application layer, there's the need awareness to direct the various tenants’ traffic to the proper indexes while also managing resources at the service level across all tenants.
8484

8585
A key attribute of the index-per-tenant model is the ability for the application developer to oversubscribe the capacity of a search service among the application’s tenants. If the tenants have an uneven distribution of workload, the optimal combination of tenants can be distributed across a search service’s indexes to accommodate a number of highly active, resource-intensive tenants while simultaneously serving a long tail of less active tenants. The trade-off is the inability of the model to handle situations where each tenant is concurrently highly active.
8686

articles/search/search-query-odata-full-text-search-functions.md

Lines changed: 209 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,15 @@ ms.service: azure-ai-search
1010
ms.custom:
1111
- ignite-2023
1212
ms.topic: reference
13-
ms.date: 09/16/2021
14-
translation.priority.mt:
15-
- "de-de"
16-
- "es-es"
17-
- "fr-fr"
18-
- "it-it"
19-
- "ja-jp"
20-
- "ko-kr"
21-
- "pt-br"
22-
- "ru-ru"
23-
- "zh-cn"
24-
- "zh-tw"
13+
ms.date: 07/10/2025
14+
2515
---
2616
# OData full-text search functions in Azure AI Search - `search.ismatch` and `search.ismatchscoring`
2717

28-
Azure AI Search supports full-text search in the context of [OData filter expressions](query-odata-filter-orderby-syntax.md) via the `search.ismatch` and `search.ismatchscoring` functions. These functions allow you to combine full-text search with strict Boolean filtering in ways that are not possible just by using the top-level `search` parameter of the [Search API](/rest/api/searchservice/documents/search-post).
18+
Azure AI Search supports full-text search in the context of [OData filter expressions](query-odata-filter-orderby-syntax.md) via the `search.ismatch` and `search.ismatchscoring` functions. These functions allow you to combine full-text search with strict Boolean filtering in ways that aren't possible just by using the top-level `search` parameter of the [Search API](/rest/api/searchservice/documents/search-post).
2919

3020
> [!NOTE]
31-
> The `search.ismatch` and `search.ismatchscoring` functions are only supported in filters in the [Search API](/rest/api/searchservice/documents/search-post). They are not supported in the [Suggest](/rest/api/searchservice/documents/suggest-post) or [Autocomplete](/rest/api/searchservice/documents/autocomplete-post) APIs.
21+
> The `search.ismatch` and `search.ismatchscoring` functions are only supported in filters in the [Search API](/rest/api/searchservice/documents/search-post). They aren't supported in the [Suggest](/rest/api/searchservice/documents/suggest-post) or [Autocomplete](/rest/api/searchservice/documents/autocomplete-post) APIs.
3222
3323
## Syntax
3424

@@ -58,7 +48,7 @@ An interactive syntax diagram is also available:
5848
5949
### search.ismatch
6050

61-
The `search.ismatch` function evaluates a full-text search query as a part of a filter expression. The documents that match the search query will be returned in the result set. The following overloads of this function are available:
51+
The `search.ismatch` function evaluates a full-text search query as a part of a filter expression. Matching documents are returned in the result set. The following overloads of this function are available:
6252

6353
- `search.ismatch(search)`
6454
- `search.ismatch(search, searchFields)`
@@ -69,21 +59,20 @@ The parameters are defined in the following table:
6959
| Parameter name | Type | Description |
7060
| --- | --- | --- |
7161
| `search` | `Edm.String` | The search query (in either [simple](query-simple-syntax.md) or [full](query-lucene-syntax.md) Lucene query syntax). |
72-
| `searchFields` | `Edm.String` | Comma-separated list of searchable fields to search in; defaults to all searchable fields in the index. When using [fielded search](query-lucene-syntax.md#bkmk_fields) in the `search` parameter, the field specifiers in the Lucene query override any fields specified in this parameter. |
62+
| `searchFields` | `Edm.String` | Comma-separated list of searchable fields to search in; defaults to all searchable fields in the index. When you use [fielded search](query-lucene-syntax.md#bkmk_fields) in the `search` parameter, the field specifiers in the Lucene query override any fields specified in this parameter. |
7363
| `queryType` | `Edm.String` | `'simple'` or `'full'`; defaults to `'simple'`. Specifies what query language was used in the `search` parameter. |
74-
| `searchMode` | `Edm.String` | `'any'` or `'all'`, defaults to `'any'`. Indicates whether any or all of the search terms in the `search` parameter must be matched in order to count the document as a match. When using the [Lucene Boolean operators](query-lucene-syntax.md#bkmk_boolean) in the `search` parameter, they will take precedence over this parameter. |
64+
| `searchMode` | `Edm.String` | `'any'` or `'all'`, defaults to `'any'`. Indicates whether any or all of the search terms in the `search` parameter must be matched in order to count the document as a match. When you use the [Lucene Boolean operators](query-lucene-syntax.md#bkmk_boolean) in the `search` parameter, they take precedence over this parameter. |
7565

7666
All the above parameters are equivalent to the corresponding [search request parameters in the Search API](/rest/api/searchservice/documents/search-post).
7767

78-
The `search.ismatch` function returns a value of type `Edm.Boolean`, which allows you to compose it with other filter sub-expressions using the Boolean [logical operators](search-query-odata-logical-operators.md).
68+
The `search.ismatch` function returns a value of type `Edm.Boolean`, which allows you to compose it with other filter subexpressions using the Boolean [logical operators](search-query-odata-logical-operators.md).
7969

8070
> [!NOTE]
81-
> Azure AI Search does not support using `search.ismatch` or `search.ismatchscoring` inside lambda expressions. This means it is not possible to write filters over collections of objects that can correlate full-text search matches with strict filter matches on the same object. For more details on this limitation as well as examples, see [Troubleshooting collection filters in Azure AI Search](search-query-troubleshoot-collection-filters.md). For more in-depth information on why this limitation exists, see [Understanding collection filters in Azure AI Search](search-query-understand-collection-filters.md).
82-
71+
> Azure AI Search doesn't support using `search.ismatch` or `search.ismatchscoring` inside lambda expressions. This means it isn't possible to write filters over collections of objects that can correlate full-text search matches with strict filter matches on the same object. For more information on this limitation as well as examples, see [Troubleshooting collection filters in Azure AI Search](search-query-troubleshoot-collection-filters.md). For more in-depth information on why this limitation exists, see [Understanding collection filters in Azure AI Search](search-query-understand-collection-filters.md).
8372
8473
### search.ismatchscoring
8574

86-
The `search.ismatchscoring` function, like the `search.ismatch` function, returns `true` for documents that match the full-text search query passed as a parameter. The difference between them is that the relevance score of documents matching the `search.ismatchscoring` query will contribute to the overall document score, while in the case of `search.ismatch`, the document score won't be changed. The following overloads of this function are available with parameters identical to those of `search.ismatch`:
75+
The `search.ismatchscoring` function, like the `search.ismatch` function, returns `true` for documents that match the full-text search query passed as a parameter. The difference between them is that the relevance score of documents matching the `search.ismatchscoring` query contributes to the overall document score, whereas for `search.ismatch`, the document score doesn't change. The following overloads of this function are available with parameters identical to those of `search.ismatch`:
8776

8877
- `search.ismatchscoring(search)`
8978
- `search.ismatchscoring(search, searchFields)`
@@ -99,10 +88,36 @@ Find documents with the word "waterfront". This filter query is identical to a [
9988
search.ismatchscoring('waterfront')
10089
```
10190

102-
Find documents with the word "hostel" and rating greater or equal to 4, or documents with the word "motel" and rating equal to 5. Note, this request could not be expressed without the `search.ismatchscoring` function.
91+
Here's the full query syntax for this request, which you can run in Search Explorer in the Azure portal. Output consists of matches on waterfront, water, and front.
92+
93+
```json
94+
{
95+
"search": "*",
96+
"select": "HotelId, HotelName, Description",
97+
"searchMode": "all",
98+
"queryType": "simple",
99+
"count": true,
100+
"filter": "search.ismatchscoring('waterfront')"
101+
}
102+
```
103+
104+
Find documents with the word "pool" and rating greater or equal to 4, or documents with the word "motel" and equal to 3.2. Note, this request couldn't be expressed without the `search.ismatchscoring` function.
103105

104106
```odata-filter-expr
105-
search.ismatchscoring('hostel') and Rating ge 4 or search.ismatchscoring('motel') and Rating eq 5
107+
search.ismatchscoring('pool') and Rating ge 4 or search.ismatchscoring('motel') and Rating eq 3.2
108+
```
109+
110+
Here's the full query syntax for this request for Search Explorer. Output consists of matches on hotels with pools having a rating greater than 4, *or* motels with a rating equal to 3.2.
111+
112+
```json
113+
{
114+
"search": "*",
115+
"select": "HotelId, HotelName, Description, Tags, Rating",
116+
"searchMode": "all",
117+
"queryType": "simple",
118+
"count": true,
119+
"filter": "search.ismatchscoring('pool') and Rating ge 4 or search.ismatchscoring('motel') and Rating eq 3.2"
120+
}
106121
```
107122

108123
Find documents without the word "luxury".
@@ -111,26 +126,192 @@ Find documents without the word "luxury".
111126
not search.ismatch('luxury')
112127
```
113128

114-
Find documents with the phrase "ocean view" or rating equal to 5. The `search.ismatchscoring` query will be executed only against fields `HotelName` and `Rooms/Description`.
129+
Here's the full query syntax for this request. Output consists of matches on the term luxury.
130+
131+
```json
132+
{
133+
"search": "*",
134+
"select": "HotelId, HotelName, Description, Tags, Rating",
135+
"searchMode": "all",
136+
"queryType": "simple",
137+
"count": true,
138+
"filter": "not search.ismatch('luxury')"
139+
}
140+
```
115141

116-
Documents that matched only the second clause of the disjunction will be returned too -- hotels with `Rating` equal to 5. To make it clear that those documents didn't match any of the scored parts of the expression, they will be returned with score equal to zero.
142+
Find documents with the phrase "ocean" or rating equal to 3.2. The `search.ismatchscoring` query is executed only against fields `HotelName` and `Description`.
117143

118-
```odata-filter-expr
119-
search.ismatchscoring('"ocean view"', 'Rooms/Description,HotelName') or Rating eq 5
144+
Here's the full query syntax for this request. Documents that match only the second clause of the disjunction are returned too (specifically, hotels with `Rating` equal to `3.2`). To make it clear that those documents didn't match any of the scored parts of the expression, they're returned with score equal to zero.
145+
146+
```json
147+
{
148+
"search": "*",
149+
"select": "HotelId, HotelName, Description, Rating",
150+
"searchMode": "all",
151+
"queryType": "full",
152+
"count": true,
153+
"filter": "search.ismatchscoring('ocean', 'Description,HotelName') or Rating eq 3.2"
154+
}
120155
```
121156

122-
Find documents where the terms "hotel" and "airport" are within 5 words from each other in the description of the hotel, and where smoking is not allowed in at least some of the rooms. This query uses the [full Lucene query language](query-lucene-syntax.md).
157+
Output consists of 4 matches: hotels that mention "ocean" in the Description or Hotel Name, or hotels with a rating of 3.2. Notice the search score of zero for matches on the second clause.
158+
159+
```json
160+
{
161+
"@odata.count": 4,
162+
"value": [
163+
{
164+
"@search.score": 1.6076145,
165+
"HotelId": "18",
166+
"HotelName": "Ocean Water Resort & Spa",
167+
"Description": "New Luxury Hotel for the vacation of a lifetime. Bay views from every room, location near the pier, rooftop pool, waterfront dining & more.",
168+
"Rating": 4.2
169+
},
170+
{
171+
"@search.score": 1.0594962,
172+
"HotelId": "41",
173+
"HotelName": "Windy Ocean Motel",
174+
"Description": "Oceanfront hotel overlooking the beach features rooms with a private balcony and 2 indoor and outdoor pools. Inspired by the natural beauty of the island, each room includes an original painting of local scenes by the owner. Rooms include a mini fridge, Keurig coffee maker, and flatscreen TV. Various shops and art entertainment are on the boardwalk, just steps away.",
175+
"Rating": 3.5
176+
},
177+
{
178+
"@search.score": 0,
179+
"HotelId": "40",
180+
"HotelName": "Trails End Motel",
181+
"Description": "Only 8 miles from Downtown. On-site bar/restaurant, Free hot breakfast buffet, Free wireless internet, All non-smoking hotel. Only 15 miles from airport.",
182+
"Rating": 3.2
183+
},
184+
{
185+
"@search.score": 0,
186+
"HotelId": "26",
187+
"HotelName": "Planetary Plaza & Suites",
188+
"Description": "Extend Your Stay. Affordable home away from home, with amenities like free Wi-Fi, full kitchen, and convenient laundry service.",
189+
"Rating": 3.2
190+
}
191+
]
192+
}
193+
```
194+
195+
Find documents where the terms "hotel" and "airport" are within 5 words from each other in the description of the hotel, and where smoking isn't allowed in at least some of the rooms.
123196

124197
```odata-filter-expr
125198
search.ismatch('"hotel airport"~5', 'Description', 'full', 'any') and Rooms/any(room: not room/SmokingAllowed)
126199
```
127200

201+
Here's the full query syntax. To run in Search Explorer, escape the interior quotation marks with a backslash character.
202+
203+
```json
204+
{
205+
"search": "*",
206+
"select": "HotelId, HotelName, Description, Tags, Rating",
207+
"searchMode": "all",
208+
"queryType": "simple",
209+
"count": true,
210+
"filter": "search.ismatch('\"hotel airport\"~5', 'Description', 'full', 'any') and Rooms/any(room: not room/SmokingAllowed)"
211+
}
212+
```
213+
214+
Output consists of a single document where the terms "hotel" and "airport" are within 5 words distance. Smoking is allowed for several rooms in most hotels, including the one in this search result.
215+
216+
```json
217+
{
218+
"@odata.count": 1,
219+
"value": [
220+
{
221+
"@search.score": 1,
222+
"HotelId": "40",
223+
"HotelName": "Trails End Motel",
224+
"Description": "Only 8 miles from Downtown. On-site bar/restaurant, Free hot breakfast buffet, Free wireless internet, All non-smoking hotel. Only 15 miles from airport.",
225+
"Tags": [
226+
"bar",
227+
"free wifi",
228+
"restaurant"
229+
],
230+
"Rating": 3.2
231+
}
232+
]
233+
}
234+
```
235+
128236
Find documents that have a word that starts with the letters "lux" in the Description field. This query uses [prefix search](query-simple-syntax.md#prefix-queries) in combination with `search.ismatch`.
129237

130238
```odata-filter-expr
131239
search.ismatch('lux*', 'Description')
132240
```
133241

242+
Here's a full query:
243+
244+
```json
245+
{
246+
"search": "*",
247+
"select": "HotelId, HotelName, Description, Tags, Rating",
248+
"searchMode": "all",
249+
"queryType": "simple",
250+
"count": true,
251+
"filter": "search.ismatch('lux*', 'Description')"
252+
}
253+
```
254+
255+
Output consists of the following matches.
256+
257+
```json
258+
{
259+
"@odata.count": 4,
260+
"value": [
261+
{
262+
"@search.score": 1,
263+
"HotelId": "18",
264+
"HotelName": "Ocean Water Resort & Spa",
265+
"Description": "New Luxury Hotel for the vacation of a lifetime. Bay views from every room, location near the pier, rooftop pool, waterfront dining & more.",
266+
"Tags": [
267+
"view",
268+
"pool",
269+
"restaurant"
270+
],
271+
"Rating": 4.2
272+
},
273+
{
274+
"@search.score": 1,
275+
"HotelId": "13",
276+
"HotelName": "Luxury Lion Resort",
277+
"Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium and transportation hubs, we feature the best in convenience and comfort.",
278+
"Tags": [
279+
"bar",
280+
"concierge",
281+
"restaurant"
282+
],
283+
"Rating": 4.1
284+
},
285+
{
286+
"@search.score": 1,
287+
"HotelId": "16",
288+
"HotelName": "Double Sanctuary Resort",
289+
"Description": "5 star Luxury Hotel - Biggest Rooms in the city. #1 Hotel in the area listed by Traveler magazine. Free WiFi, Flexible check in/out, Fitness Center & espresso in room.",
290+
"Tags": [
291+
"view",
292+
"pool",
293+
"restaurant",
294+
"bar",
295+
"continental breakfast"
296+
],
297+
"Rating": 4.2
298+
},
299+
{
300+
"@search.score": 1,
301+
"HotelId": "14",
302+
"HotelName": "Twin Vortex Hotel",
303+
"Description": "New experience in the making. Be the first to experience the luxury of the Twin Vortex. Reserve one of our newly-renovated guest rooms today.",
304+
"Tags": [
305+
"bar",
306+
"restaurant",
307+
"concierge"
308+
],
309+
"Rating": 4.4
310+
}
311+
]
312+
}
313+
```
314+
134315
## Next steps
135316

136317
- [Filters in Azure AI Search](search-filters.md)

0 commit comments

Comments
 (0)