Newer Version Available
SearchResult
The search() call returns a SearchResult object,
which has the following properties.
| Name | Type | Description |
|---|---|---|
| queryId | string | Unique identifier for the SOSL search. |
| searchRecords | SearchRecord[] | Array of SearchRecord objects, each of which contains an sObject. |
| searchResultsMetadata | SearchResultsMetadata | Metadata for SearchRecords. |
SearchRecord
Represents an individual record returned from a search.
| Name | Type | Description |
|---|---|---|
| record | sObject | The individual record returned by the search. |
| searchRecordMetadata | SearchRecordMetadata | Metadata for searchRecords. |
| snippet | SearchSnippet | On the search results page, shows terms that match the search string highlighted within the surrounding text. |
SearchRecordMetadata
Metadata for search results at the record level.
| Name | Type | Description |
|---|---|---|
| spellCorrected | boolean | Indicates that a record matches a spell-corrected search term. Appears in the response only when true. |
SearchSnippet
Excerpts shown on search results pages for article, case, feed, and idea searches.
| Name | Type | Description |
|---|---|---|
| text | string | The excerpt that contains the match for the search term. |
| wholeFields | WholeFields | The list of highlighted fields. |
WholeFields
Contains the complete text of each field that contains highlighting for terms that match the search query. The highlighted terms are surrounded by <mark> tags.
| Name | Type | Description |
|---|---|---|
| name | string | The name of the highlighted field. |
| value | string | The highlighted text. |
SearchResultsMetadata
Global metadata for the search result.
| Name | Type | Description |
|---|---|---|
| entityMetadata | EntitySearchMetadata | Search results metadata at the object level. |
EntitySearchMetadata
Metadata for search results at the object level.
| Name | Type | Description |
|---|---|---|
| fieldMetadata | FieldLevelSearchMetadata | Metadata for search results at the field level. |
| spellCorrectionMetadata | EntitySpellCorrectionMetadata | Metadata for spelling correction at the object level. |
| entityName | string | Identifies the object. |
FieldLevelSearchMetadata
Metadata for search results at the field level.
| Name | Type | Description |
|---|---|---|
| name | string | The field name. |
| label | string | The field label. |
| type | string | The field type. |
EntitySpellCorrectionMetadata
Metadata for spelling correction at the object level. Appears in the response only when at least one record for an object matches a spell-corrected search term.
| Name | Type | Description |
|---|---|---|
| correctedQuery | string | The spell-corrected search term. |
| hasNonCorrectedResults | boolean | If true, indicates that the user has access to at least one record that matches a search term that wasn't spell-corrected. Each object sometimes returns a different value. |