Skip to content

Commit 73cb3f4

Browse files
authored
Merge pull request #216756 from HeidiSteen/heidist-gh
[azure search] Revise semantic search into a how-to guide
2 parents c9becce + 9e2a02d commit 73cb3f4

9 files changed

+218
-342
lines changed

articles/search/TOC.yml

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@
184184
href: /security/benchmark/azure/baselines/cognitive-search-security-baseline?toc=/azure/search/TOC.json
185185
- name: How-to guides
186186
items:
187+
- name: Create a search service
188+
href: search-create-service-portal.md
187189
- name: Planning
188190
items:
189191
- name: Choose a tier
@@ -200,8 +202,6 @@
200202
href: search-modeling-multitenant-saas-applications.md
201203
- name: Service management
202204
items:
203-
- name: Create a service
204-
href: search-create-service-portal.md
205205
- name: Manage in the portal
206206
href: search-manage.md
207207
- name: Manage with PowerShell
@@ -422,46 +422,50 @@
422422
items:
423423
- name: Create a basic query
424424
href: search-query-create.md
425-
- name: Create a semantic query
426-
href: semantic-how-to-query-request.md
427-
- name: Return a semantic answer
428-
href: semantic-answers.md
429-
- name: Add spell check to queries
430-
href: speller-how-to-add.md
431-
- name: Search results paging and formatting
432-
href: search-pagination-page-layout.md
433425
- name: Use simple syntax (examples)
434426
href: search-query-simple-examples.md
435-
- name: Use full Lucene (examples)
436-
href: search-query-lucene-examples.md
437-
- name: Partial terms and special characters
438-
href: search-query-partial-matching.md
439-
- name: Fuzzy search
440-
href: search-query-fuzzy.md
427+
- name: Add spell check to queries
428+
href: speller-how-to-add.md
441429
- name: Autocomplete "Search-as-you-type"
442430
items:
443431
- name: Create a suggester
444432
href: index-add-suggesters.md
445433
- name: Add autocomplete and suggestions
446434
href: search-add-autocomplete-suggestions.md
447-
- name: Filters
448-
items:
449-
- name: Filter overview
450-
href: search-filters.md
451-
- name: Add faceted navigation
452-
href: search-faceted-navigation.md
453-
- name: Troubleshoot collection filters
454-
href: search-query-troubleshoot-collection-filters.md
455-
- name: Understand collection filters
456-
href: search-query-understand-collection-filters.md
457-
- name: Normalize text
458-
href: search-normalizers.md
435+
- name: Filters
436+
items:
437+
- name: Filter overview
438+
href: search-filters.md
439+
- name: Add faceted navigation
440+
href: search-faceted-navigation.md
441+
- name: Troubleshoot collection filters
442+
href: search-query-troubleshoot-collection-filters.md
443+
- name: Understand collection filters
444+
href: search-query-understand-collection-filters.md
445+
- name: Normalize text
446+
href: search-normalizers.md
447+
- name: Search results
448+
items:
449+
- name: Paging, sorting, and formatting
450+
href: search-pagination-page-layout.md
451+
- name: Return a semantic answer
452+
href: semantic-answers.md
453+
- name: Advanced queries
454+
items:
455+
- name: Use full Lucene (examples)
456+
href: search-query-lucene-examples.md
457+
- name: Partial terms and special characters
458+
href: search-query-partial-matching.md
459+
- name: Fuzzy search
460+
href: search-query-fuzzy.md
459461
- name: Relevance
460462
items:
461463
- name: Configure scoring
462464
href: index-ranking-similarity.md
463465
- name: Add a scoring profile
464466
href: index-add-scoring-profiles.md
467+
- name: Configure semantic search
468+
href: semantic-how-to-query-request.md
465469
- name: Performance and monitoring
466470
items:
467471
- name: Performance analysis

articles/search/search-pagination-page-layout.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: How to work with search results
33
titleSuffix: Azure Cognitive Search
4-
description: Structure and sort search results, get a document count, and add content navigation to search results in Azure Cognitive Search.
4+
description: Define search result composition, get a document count, sort results, and add content navigation to search results in Azure Cognitive Search.
55

66
manager: nitinme
77
author: HeidiSteen
88
ms.author: heidist
99
ms.service: cognitive-search
10-
ms.topic: conceptual
11-
ms.date: 07/22/2022
10+
ms.topic: how-to
11+
ms.date: 11/01/2022
1212
---
1313

1414
# How to work with search results in Azure Cognitive Search
@@ -20,7 +20,7 @@ Parameters on the query determine:
2020
+ Selection of fields within results
2121
+ Count of matches found in the index for the query
2222
+ Number of results in the response (up to 50, by default)
23-
+ Sort order of results
23+
+ Sort order
2424
+ Highlighting of terms within a result, matching on either the whole or partial term in the body
2525

2626
## Result composition
@@ -53,7 +53,7 @@ Occasionally, the substance and not the structure of results are unexpected. For
5353

5454
## Counting matches
5555

56-
The count parameter returns the number of documents in the index that are considered a match for the query. To return the count, add **`$count=true`** to the query request. There is no maximum value imposed by the search service. Depending on your query and the content of your documents, the count could be as high as every document in the index.
56+
The count parameter returns the number of documents in the index that are considered a match for the query. To return the count, add **`$count=true`** to the query request. There's no maximum value imposed by the search service. Depending on your query and the content of your documents, the count could be as high as every document in the index.
5757

5858
Count is accurate when the index is stable. If the system is actively adding, updating, or deleting documents, the count will be approximate, excluding any documents that aren't fully indexed.
5959

@@ -74,7 +74,7 @@ To control the paging of all documents returned in a result set, add `$top` and
7474

7575
+ Return the second set, skipping the first 15 to get the next 15: `$top=15&$skip=15`. Repeat for the third set of 15: `$top=15&$skip=30`
7676

77-
The results of paginated queries aren't guaranteed to be stable if the underlying index is changing. Paging changes the value of `$skip` for each page, but each query is independent and operates on the current view of the data as it exists in the index at query time (in other words, there is no caching or snapshot of results, such as those found in a general purpose database).
77+
The results of paginated queries aren't guaranteed to be stable if the underlying index is changing. Paging changes the value of `$skip` for each page, but each query is independent and operates on the current view of the data as it exists in the index at query time (in other words, there's no caching or snapshot of results, such as those found in a general purpose database).
7878

7979
Following is an example of how you might get duplicates. Assume an index with four documents:
8080

@@ -103,9 +103,9 @@ Notice that document 2 is fetched twice. This is because the new document 5 has
103103

104104
## Ordering results
105105

106-
In a full text search query, results can be ranked by a search score, a semantic re-ranker score (if using [semantic search](semantic-search-overview.md)), or by an **`$orderby`** expression in the query request.
106+
In a full text search query, results can be ranked by a search score, a semantic reranker score (if using [semantic search](semantic-search-overview.md)), or by an **`$orderby`** expression in the query request.
107107

108-
A @search.score equal to 1.00 indicates an un-scored or un-ranked result set, where the 1.0 score is uniform across all results. Un-scored results occur when the query form is fuzzy search, wildcard or regex queries, or an empty search (`search=*`). If you need to impose a ranking structure over un-scored results, an **`$orderby`** expression will help you achieve that objective.
108+
A @search.score equal to 1.00 indicates an unscored or unranked result set, where the 1.0 score is uniform across all results. Unscored results occur when the query form is fuzzy search, wildcard or regex queries, or an empty search (`search=*`). If you need to impose a ranking structure over unscored results, an **`$orderby`** expression will help you achieve that objective.
109109

110110
For full text search queries, results are automatically ranked by a search score, calculated based on term frequency and proximity in a document (derived from [TF-IDF](https://en.wikipedia.org/wiki/Tf%E2%80%93idf)), with higher scores going to documents having more or stronger matches on a search term.
111111

@@ -129,7 +129,7 @@ Another approach that promotes order consistency is using a [custom scoring prof
129129

130130
Hit highlighting refers to text formatting (such as bold or yellow highlights) applied to matching terms in a result, making it easy to spot the match. Highlighting is useful for longer content fields, such as a description field, where the match isn't immediately obvious.
131131

132-
Notice that highlighting is applied to individual terms. There is no highlight capability for the contents of an entire field. If you want highlighting over a phrase, you'll have to provide the matching terms (or phrase) in a quote-enclosed query string. This technique is described further on in this section.
132+
Notice that highlighting is applied to individual terms. There's no highlight capability for the contents of an entire field. If you want to highlight over a phrase, you'll have to provide the matching terms (or phrase) in a quote-enclosed query string. This technique is described further on in this section.
133133

134134
Hit highlighting instructions are provided on the [query request](/rest/api/searchservice/search-documents). Queries that trigger query expansion in the engine, such as fuzzy and wildcard search, have limited support for hit highlighting.
135135

@@ -166,7 +166,7 @@ In a keyword search, each term is scanned for independently. A query for "divine
166166

167167
### Keyword search highlighting
168168

169-
Within a highlighted field, formatting is applied to whole terms. For example, on a match against "The Divine Secrets of the Ya-Ya Sisterhood", formatting is applied to each term separately, even though they are consecutive.
169+
Within a highlighted field, formatting is applied to whole terms. For example, on a match against "The Divine Secrets of the Ya-Ya Sisterhood", formatting is applied to each term separately, even though they're consecutive.
170170

171171
```json
172172
"@odata.count": 39,

articles/search/search-query-odata-orderby.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.date: 07/18/2022
1515

1616
In Azure Cognitive Search, the **$orderby** parameter specifies custom sort order for search results. This article describes the OData syntax of **$orderby** and provides examples.
1717

18-
Field path construction and constants are described in the [OData language overview in Azure Cognitive Search](query-odata-filter-orderby-syntax.md). For more information about sorting and search results composition, see [How to work with search results in Azure Cognitive Search](search-pagination-page-layout.md).
18+
Field path construction and constants are described in the [OData language overview in Azure Cognitive Search](query-odata-filter-orderby-syntax.md). For more information about sorting algorithms, see [Ordering results](search-pagination-page-layout.md#ordering-results).
1919

2020
## Syntax
2121

@@ -77,7 +77,7 @@ Sort hotels in descending order by search.score and rating, and then in ascendin
7777
$orderby=search.score() desc,Rating desc,geo.distance(Location, geography'POINT(-122.131577 47.678581)') asc
7878
```
7979

80-
## Next steps
80+
## See also
8181

8282
- [How to work with search results in Azure Cognitive Search](search-pagination-page-layout.md)
8383
- [OData expression language overview for Azure Cognitive Search](query-odata-filter-orderby-syntax.md)

articles/search/semantic-answers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ All prerequisites that apply to [semantic queries](semantic-how-to-query-request
2828

2929
+ Query strings entered by the user must be recognizable as a question (what, where, when, how).
3030

31-
+ Search documents in the index must contain text having the characteristics of an answer, and that text must exist in one of the fields listed in the [semantic configuration](semantic-how-to-query-request.md#create-a-semantic-configuration). For example, given a query "what is a hash table", if none of the fields in the semantic configuration contain passages that include "A hash table is ...", then it's unlikely an answer will be returned.
31+
+ Search documents in the index must contain text having the characteristics of an answer, and that text must exist in one of the fields listed in the [semantic configuration](semantic-how-to-query-request.md#2---create-a-semantic-configuration). For example, given a query "what is a hash table", if none of the fields in the semantic configuration contain passages that include "A hash table is ...", then it's unlikely an answer will be returned.
3232

3333
## What is a semantic answer?
3434

@@ -42,7 +42,7 @@ Answers are returned as an independent, top-level object in the query response p
4242

4343
## Formulate a query rest for "answers"
4444

45-
The approach for listing fields in priority order has changed recently, with "semanticConfiguration" replacing "searchFields". If you're currently using searchFields, update your code to the 2021-04-30-Preview API version and use "semanticConfiguration" instead.
45+
The approach for listing fields in priority order has changed, with "semanticConfiguration" replacing "searchFields". If you're currently using searchFields, update your code to the 2021-04-30-Preview API version and use "semanticConfiguration" instead.
4646

4747
### [**Semantic Configuration (recommended)**](#tab/semanticConfiguration)
4848

@@ -68,7 +68,7 @@ The "semanticConfiguration" parameter is crucial to returning a high-quality ans
6868

6969
+ "queryLanguage" must be one of the values from the [supported languages list (REST API)](/rest/api/searchservice/preview-api/search-documents#queryLanguage).
7070

71-
+ A "semanticConfiguration" determines which string fields provide tokens to the extraction model. The same fields that produce captions also produce answers. See [Create a semantic configuration](semantic-how-to-query-request.md#searchfields) for details.
71+
+ A "semanticConfiguration" determines which string fields provide tokens to the extraction model. The same fields that produce captions also produce answers. See [Configure semantic ranking](semantic-how-to-query-request.md#2---create-a-semantic-configuration) for details.
7272

7373
+ For "answers", parameter construction is `"answers": "extractive"`, where the default number of answers returned is one. You can increase the number of answers by adding a `count` as shown in the above example, up to a maximum of 10. Whether you need more than one answer depends on the user experience of your app, and how you want to render results.
7474

@@ -95,7 +95,7 @@ The "searchFields" parameter is crucial to returning a high-quality answer, both
9595

9696
+ "queryLanguage" must be one of the values from the [supported languages list (REST API)](/rest/api/searchservice/preview-api/search-documents#queryLanguage).
9797

98-
+ "searchFields" determines which string fields provide tokens to the extraction model. The same fields that produce captions also produce answers. See [Set searchFields](semantic-how-to-query-request.md#searchfields) for details.
98+
+ "searchFields" determines which string fields provide tokens to the extraction model. The same fields that produce captions also produce answers. See [Set searchFields](semantic-how-to-query-request.md#2b---use-searchfields-for-field-prioritization) for details.
9999

100100
+ For "answers", parameter construction is `"answers": "extractive"`, where the default number of answers returned is one. You can increase the number of answers by adding a `count` as shown in the above example, up to a maximum of 10. Whether you need more than one answer depends on the user experience of your app, and how you want to render results.
101101

@@ -158,7 +158,7 @@ Within @search.answers:
158158

159159
+ **"score"** is a confidence score that reflects the strength of the answer. If there are multiple answers in the response, this score is used to determine the order. Top answers and top captions can be derived from different search documents, where the top answer originates from one document, and the top caption from another, but in general you will see the same documents in the top positions within each array.
160160

161-
Answers are followed by the **"value"** array, which always includes scores, captions, and any fields that are retrievable by default. If you specified the select parameter, the "value" array is limited to the fields that you specified. See [Create a semantic query](semantic-how-to-query-request.md) for details.
161+
Answers are followed by the **"value"** array, which always includes scores, captions, and any fields that are retrievable by default. If you specified the select parameter, the "value" array is limited to the fields that you specified. See [Configure semantic ranking](semantic-how-to-query-request.md) for details.
162162

163163
## Tips for producing high-quality answers
164164

@@ -175,4 +175,4 @@ For best results, return semantic answers on a document corpus having the follow
175175
+ [Semantic search overview](semantic-search-overview.md)
176176
+ [Semantic ranking algorithm](semantic-ranking.md)
177177
+ [Similarity ranking algorithm](index-ranking-similarity.md)
178-
+ [Create a semantic query](semantic-how-to-query-request.md)
178+
+ [Configure semantic ranking](semantic-how-to-query-request.md)

0 commit comments

Comments
 (0)