Newer Version Available
WITH HIGHLIGHT
Highlighted search terms are generated from the following standard and custom field types.
- Auto number
- Text
- Text Area
- Text Area (Long)
Highlighted search terms are not generated from the following field types.
- Checkbox
- Compound fields
- Currency
- Date
- Date/Time
- File
- Formula
- Lookup Relationship
- Number
- Percent
- Phone
- Picklist
- Picklist (Multi-Select)
- Text Area (Rich)
- URL
Example
1FIND {salesforce} IN ALL FIELDS RETURNING Account(Name,Description) WITH HIGHLIGHTThe matching terms are highlighted with <mark> tags. If the original search term doesn’t yield any results because of incorrect spelling, the corrected spelling of the search term is highlighted in the results.
Example
1{
2 "searchRecords" : [ {
3 "attributes" : {
4 "type" : "Account",
5 "url" : "/services/data/v39.0/sobjects/Account/001xx000003DpxkAAC"
6 },
7 "Name" : "salesforce",
8 "Description" : "Salesforce.com",
9 "highlight.Description" : "<mark>salesforce</mark>.com",
10 "highlight.Name" :
11 "<mark>salesforce</mark>"
12 } ]
13}Example
The following statement returns search results with the search term salesforce west highlighted for the custom field BuildingDescription of the custom object Building.
1FIND {Salesforce West} IN ALL FIELDS RETURNING Building__c(Name, BuildingDescription__c) WITH HIGHLIGHTUsage
Search terms that contain a wildcard are not highlighted.
Other objects that are included in searches that contain WITH HIGHLIGHT don’t return highlighted search terms.
A maximum of 25 records per entity per SOSL query are highlighted.