Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

SearchResults Class

Wraps the results returned by the Search.find(String​) method.

Namespace

Search

SearchResults Methods

The following are methods for SearchResults.

get(sObjectType)

Returns a list of Search.SearchResult objects that contain an sObject of the specified type.

Signature

public List<Search.SearchResult> get(String sObjectType)

Parameters

  • sObjectType: Type: String The name of an sObject in the dynamic SOSL query passed to the Search.find(String) method.

Return Value

Type: List<Search.SearchResult>

Usage

SOSL queries passed to the Search.find(String) method can return results for multiple objects. For example, the query Search.find('FIND \'map\' IN ALL FIELDS RETURNING Account, Contact, Opportunity') includes results for 3 objects. You can call get(string) to retrieve search results for 1 object at a time. For example, to get results for the Account object, call Search.SearchResults.get('Account').