SearchResults Class

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

Search

The following are methods for SearchResults.

  • get(sObjectType)

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

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

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

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

Type: List<Search.SearchResult>

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

See Also