5

Is it possible to get the highlight field from a SOSL search within apex?

For example:

List<List<Contact>> results = [
  FIND {text} IN ALL FIELDS RETURNING Contact(Id, Name) WITH HIGHLIGHT
];

Is there a way to get the highlight field containing the <mark>text</mark> tags? For example:

contact.get('highlight.Name');

Or is this only available when executing SOSL using the API?

2

Unfortunately, it is available only in SOAP api and REST api as mentioned in the official documentation here in Supported APIs section:

The WITH HIGHLIGHT clause in SOSL is supported in SOAP API and REST API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.