Skip to content

Commit 3139d3a

Browse files
author
Luis Cabrera
committed
New highlighting changes
1 parent 9923458 commit 3139d3a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,64 @@ POST /indexes/hotels/docs/search?api-version=2019-05-06
103103
}
104104
```
105105

106+
### Improved highlighting capability (for services created after July 15, 2020)
107+
108+
> [!NOTE]
109+
> Services created after July 15, 2020 will provide a new and improved highlighting experience. Services created before that date will not change in their highlighting behavior.
110+
>
111+
112+
#### Highlight only the matching phrases with phrase queries.
113+
Phrase queries enable searching of phrases in documents.
114+
115+
In services created before July 15, 2020, highlighting on phrase queries works by taking individual terms, regardless of their positions in the document, and including them in the response. After July 15, 2020, only the matching phrases will be highlighted.
116+
117+
For example, the query "super bowl" returns highlights like this:
118+
119+
```html
120+
'<em>super</em> <em>bowl</em> is <em>super</em> awesome with a <em>bowl</em> of chips'
121+
```
122+
123+
and requires client side filtering of terms. The newer experience will highlight only the phrase super bowl in the above text which is what matched the query:
124+
125+
```html
126+
'<em>super bowl</em> is super awesome with a bowl of chips'
127+
```
128+
129+
#### Improved experience with wildcard and fuzzy queries
130+
In services created after July 15, 2020, highlighting with wildcard and fuzzy queries on fields with scoring profiles will be supported. Previously, highlighting was only supported for wildcard and fuzzy queries on fields without scoring profiles.
131+
132+
Let's look at a simple index and queries for clarification:
133+
134+
```http
135+
{
136+
"name": "simple-index",
137+
"fields": [
138+
{
139+
"name": "key",
140+
"type": "Edm.String"
141+
},
142+
{
143+
"name": "simplefield",
144+
"type": "Edm.String"
145+
}
146+
],
147+
"scoringProfiles": [
148+
{
149+
"name": "boostedprofile",
150+
"functionAggregation": null,
151+
"text": {
152+
"weights": {
153+
"simplefield": 5,
154+
}
155+
},
156+
"functions": []
157+
}
158+
]
159+
}
160+
```
161+
162+
Using a wildcard query *search=foo*&highlight=simplefield&querytype=full* will highlight all terms starting with *foo*. The same query when used with a scoring profile *search=foo*&highlight=simplefield&querytype=full&scoringprofile=boostedprofile* will do the same, whereas before these changes it would return no highlights.
163+
106164

107165

108166
## Faceted navigation

0 commit comments

Comments
 (0)