Specify which types of text fields to search for on a SOSL query by using the IN
SearchGroup optional clause. For example, you can search for name, email, phone, sidebar,
or all fields.
You can specify one of the following values (note that numeric fields are not searchable). If
unspecified, the default behavior is to search all text fields in searchable objects.
This clause doesn’t
apply to articles, documents, feed comments, feed items, files, products, and
solutions. If these objects are specified in the RETURNING clause, the search is not
limited to specific fields, and all fields are searched.
Valid SearchGroup Settings
| ALL FIELDS |
Search all searchable fields. If the IN clause is
unspecified, then this is the default setting. |
| EMAIL FIELDS |
Search only email fields. |
| NAME FIELDS |
Search only name fields.In addition to the standard Name field on most standard
objects, these fields are also searched when using IN NAME
FIELDS for these standard objects:
- Account: Website, Site, NameLocal
- Asset: SerialNumber
- Case: SuppliedName, SuppliedCompany, Subject
- Contact: AssistantName, FirstNameLocal, LastNameLocal
- Event: Subject
- Lead: Company, CompanyLocal, FirstNameLocal, LastNameLocal
- Note: Title
- PermissionSet: Label
- Report: Description
- TagDefinition: NormName
- Task: Subject
- User: CommunityNickname
In custom objects, fields that are defined as “Name Field” are
searched. In standard and custom objects, name fields have the nameField property set to true. (See the Field array of the fields parameter of the DescribeSObjectResult for more information.) |
| PHONE FIELDS |
Search only phone number fields. |
| SIDEBAR FIELDS |
Search for valid records as listed in the Sidebar drop-down list. Unlike search in the
application, the asterisk (*) wildcard is not appended to the end of a search
string. |
While the IN clause is optional, it is recommended that you
specify the search scope unless you need to search all fields. For example, if you’re
searching only for an email address, you should specify IN EMAIL
FIELDS in order to design the most efficient search.
Example IN Clauses
| No search group |
FIND {MyProspect} |
| ALL FIELDS |
FIND {MyProspect} IN ALL FIELDS |
| EMAIL FIELDS |
FIND {mylogin@mycompany.com} IN EMAIL
FIELDS |
| NAME FIELDS |
FIND {MyProspect} IN NAME FIELDS |
| PHONE FIELDS |
FIND {MyProspect} IN PHONE FIELDS |
| SIDEBAR FIELDS |
FIND {MyProspect} IN SIDEBAR FIELDS |
| Invalid search (will not succeed) |
FIND {MyProspect} IN Accounts |