You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/index-add-scoring-profiles.md
+8-21Lines changed: 8 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,23 +85,22 @@ POST /indexes/hotels/docs&api-version=2024-07-01
85
85
86
86
This query searches on the term "inn" and passes in the current location. Notice that this query includes other parameters, such as scoringParameter. Query parameters, including "scoringParameter", are described in [Search Documents (REST API)](/rest/api/searchservice/documents/search-post).
87
87
88
-
See the [Extended example](#bkmk_ex) to review a more detailed example of a scoring profile.
89
-
90
-
<aname=what-is-default-scoring></a>
88
+
See the [Extended example](#extended-example) to review a more detailed example of a scoring profile.
91
89
92
90
## How search scoring works in Azure AI Search
93
91
94
92
Scoring profiles supplement the default scoring algorithm by boosting the scores of matches that meet the profile's criteria. Scoring functions apply to keyword search, pure vector queries, and on hybrid queries. When you use scoring profiles, all queries regardless of type are ranked using the [Reciprocal Ranking Function (RRF)](hybrid-search-ranking.md) algorithm, including standalone text and vector queries. Scoring functions directly affect the final ranking of all documents post-RRF-ranking.
95
93
96
94
:::image type="content" source="media/scoring-profiles/scoring-over-ranked-results.png" alt-text="Diagram showing which fields have a scoring profile and when ranking occurs.":::
97
95
98
-
You can use the [featuresMode (preview)](index-similarity-and-scoring.md#featuresmode-parameter-preview) parameter to request extra scoring details with the search results (including the field level scores).
96
+
> [!TIP]
97
+
> You can use the [featuresMode (preview)](index-similarity-and-scoring.md#featuresmode-parameter-preview) parameter to request extra scoring details with the search results (including the field level scores).
99
98
100
99
## Add a scoring profile to a search index
101
100
102
101
1. Start with an [index definition](/rest/api/searchservice/indexes/create). You can add and update scoring profiles on an existing index without having to rebuild it. Use an [Create or Update Index](/rest/api/searchservice/indexes/create-or-update) request to post a revision.
103
102
104
-
1. Paste in the [template](#bkmk_template) provided in this article.
103
+
1. Paste in the [template](#template) provided in this article.
105
104
106
105
1. Provide a name that adheres to [naming conventions](/rest/api/searchservice/naming-rules).
107
106
@@ -113,8 +112,6 @@ Scoring profiles can be defined in Azure portal as shown in the following screen
Use weighted fields when field context is important and queries include searchable string fields. For example, if a query includes the term "airport", you might want "airport" in the Description field to have more weight than in the HotelName.
@@ -136,15 +133,13 @@ Weighted fields are name-value pairs composed of a searchable field and a positi
136
133
]
137
134
```
138
135
139
-
<aname="functions"></a>
140
-
141
136
## Use functions
142
137
143
138
Use functions when simple relative weights are insufficient or don't apply, as is the case of distance and freshness, which are calculations over numeric data. You can specify multiple functions per scoring profile. For more information about the EDM data types used in Azure AI Search, see [Supported data types](/rest/api/searchservice/supported-data-types).
144
139
145
140
| Function | Description | Use cases |
146
141
|-|-|
147
-
| freshness | Boosts by values in a datetime field (`Edm.DateTimeOffset`). This function has a "boostingDuration" attribute so that you can specify a value representing a timespan over which boosting occurs. | Use this function to boost a match having a more recent date. You can also rank items like calendar events with future dates such that items closer to the present can be ranked higher than items further in the future. One end of the range is fixed to the current time. To boost a range of times in the past, use a positive boostingDuration. To boost a range of times in the future, use a negative boostingDuration. The [interpolation](#set-interpolations) parameter sets the slope. |
142
+
| freshness | Boosts by values in a datetime field (`Edm.DateTimeOffset`). This function has a "boostingDuration" attribute so that you can specify a value representing a timespan over which boosting occurs. | Use this function to boost a match having a more recent date. You can also rank items like calendar events with future dates such that items closer to the present can be ranked higher than items further in the future. One end of the range is fixed to the current time. To boost a range of times in the past, use a positive boostingDuration. To boost a range of times in the future, use a negative boostingDuration. The [interpolation](#set-interpolations) parameter sets the slope. For more information, see [set boostingDuration](#set-boostingduration-for-freshness-function). |
148
143
| magnitude | The magnitude scoring function is used to alter rankings based on the range of values for a numeric field. The value must be an integer or floating-point number. For star ratings of 1 through 4, this would be 1. For margins over 50%, this would be 50. This function can only be used with `Edm.Double` and `Edm.Int` fields. For the magnitude function, you can reverse the range, high to low, if you want the inverse pattern (for example, to boost lower-priced items more than higher-priced items). Given a range of prices from $100 to $1, you would set "boostingRangeStart" at 100 and "boostingRangeEnd" at 1 to boost the lower-priced items. | Scenarios that call for this function include boosting by profit margin, highest price, lowest price, or a count of downloads. Common usage examples of this are: </br></br>"Star ratings:" Alter the scoring based on the value within the "Star Rating" field. When two items are relevant, the item with the higher rating will be displayed first. </br>"Margin:" When two documents are relevant, a retailer might wish to boost documents that have higher margins first. </br>"Clickthrough counts:" For applications that track clickthrough actions to products or pages, you could use magnitude to boost items that tend to get the most traffic. </br>"Download counts:" For applications that track downloads, the magnitude function lets you boost items that have the most downloads. |
149
144
| distance | Boosts by proximity or geographic location. This function can only be used with `Edm.GeographyPoint` fields. | Use for "find near me" scenarios. |
150
145
| tag | Boosts by tags that are common to both search documents and query strings. Tags are provided in a "tagsParameter". This function can only be used with search fields of type `Edm.String` and `Collection(Edm.String)`. | Use when you have tag fields. If a given tag within the list is itself a comma-delimited list, you can [use a text normalizer](search-normalizers.md) on the field to strip out the commas at query time (map the comma character to a space). This approach will "flatten" the list so that all terms are a single, long string of comma-delimited terms. |
@@ -156,8 +151,6 @@ Use functions when simple relative weights are insufficient or don't apply, as i
156
151
+ Functions can't include null or empty values.
157
152
+ Functions can only have a single field per function definition. To use magnitude twice in the same profile, provide two definitions magnitude, one for each field.
158
153
159
-
<aname="bkmk_template"></a>
160
-
161
154
## Template
162
155
163
156
This section shows the syntax and template for scoring profiles. For a description of properties, see the [REST API reference](/rest/api/searchservice/indexes/create?view=rest-searchservice-2024-07-01&preserve-view=true#scoringfunctionaggregation).
@@ -209,9 +202,7 @@ Use functions when simple relative weights are insufficient or don't apply, as i
209
202
}
210
203
],
211
204
"defaultScoringProfile": (optional) "...",
212
-
```
213
-
214
-
<aname="bkmk_interpolation"></a>
205
+
```
215
206
216
207
## Set interpolations
217
208
@@ -226,9 +217,7 @@ Interpolations set the shape of the slope used for scoring. Because scoring is h
226
217
227
218

228
219
229
-
<aname="bkmk_boostdur"></a>
230
-
231
-
## Set boostingDuration
220
+
## Set boostingDuration for freshness function
232
221
233
222
`boostingDuration` is an attribute of the `freshness` function. You use it to set an expiration period after which boosting will stop for a particular document. For example, to boost a product line or brand for a 10-day promotional period, you would specify the 10-day period as "P10D" for those documents.
234
223
@@ -243,9 +232,7 @@ The following table provides several examples.
243
232
|15 minutes|"PT15M"|
244
233
|30 days, 5 hours, 10 minutes, and 6.334 seconds|"P30DT5H10M6.334S"|
245
234
246
-
For more examples, see [XML Schema: Datatypes (W3.org web site)](https://www.w3.org/TR/xmlschema11-2/#dayTimeDuration).
247
-
248
-
<aname="bkmk_ex"></a>
235
+
For more examples, see [XML Schema: Datatypes (W3.org web site)](https://www.w3.org/TR/xmlschema11-2/#dayTimeDuration).
Copy file name to clipboardExpand all lines: articles/search/query-lucene-syntax.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ Proximity searches are used to find terms that are near each other in a document
130
130
131
131
Term boosting refers to ranking a document higher if it contains the boosted term, relative to documents that don't contain the term. This differs from scoring profiles in that scoring profiles boost certain fields, rather than specific terms.
132
132
133
-
The following example helps illustrate the differences. Suppose that there's a scoring profile that boosts matches in a certain field, say *genre* in the [musicstoreindex example](index-add-scoring-profiles.md#bkmk_ex). Term boosting could be used to further boost certain search terms higher than others. For example, `rock^2 electronic` boosts documents that contain the search terms in the genre field higher than other searchable fields in the index. Further, documents that contain the search term *rock* are ranked higher than the other search term *electronic* as a result of the term boost value (2).
133
+
The following example helps illustrate the differences. Suppose that there's a scoring profile that boosts matches in a certain field, say *genre* in the [musicstoreindex example](index-add-scoring-profiles.md#extended-example). Term boosting could be used to further boost certain search terms higher than others. For example, `rock^2 electronic` boosts documents that contain the search terms in the genre field higher than other searchable fields in the index. Further, documents that contain the search term *rock* are ranked higher than the other search term *electronic* as a result of the term boost value (2).
134
134
135
135
To boost a term, use the caret, `^`, symbol with a boost factor (a number) at the end of the term you're searching. You can also boost phrases. The higher the boost factor, the more relevant the term is relative to other search terms. By default, the boost factor is 1. Although the boost factor must be positive, it can be less than 1 (for example, 0.20).
0 commit comments