Newer Version Available
WITH HIGHLIGHT
WITH HIGHLIGHT is an
optional clause that can be added to a SOSL query for business account, campaign,
contact, lead, opportunity, quote, and user searches. It highlights the terms matching
the search query in search results, making it easier to identify relevant content. The
WITH HIGHLIGHTING clause can be used in API
version 39.0 or later.
Highlighted search terms are generated from the following field types.
- 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
The following SOSL
statement returns search results with the search term salesforce
highlighted.
The 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
Usage
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.
Supported APIs
The WITH HIGHLIGHT
clause in SOSL is supported
in SOAP API and REST API.