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').