SOSL Syntax

SOSL uses the following syntax:

FIND {SearchQuery}[ toLabel()]
[ IN SearchGroup [ convertCurrency(Amount)] ]
[ RETURNING FieldSpec ]
[ WITH DivisionFilter ]
[ WITH DATA CATEGORY DataCategorySpec ]
[ LIMIT n ]

where:

Syntax Description
FIND {SearchQuery} Required. Specifies the text (words or phrases) to search for. The search query must be delimited with curly braces.
toLabel() Optional. Results from a query are returned translated into the user’s language.
IN SearchGroup Optional. Scope of fields to search. One of the following values:
  • ALL FIELDS
  • NAME FIELDS
  • EMAIL FIELDS
  • PHONE FIELDS
  • SIDEBAR FIELDS
If unspecified, then the default is ALL FIELDS. You can specify the list of objects to search in the RETURNING FieldSpec clause.
Note
This clause doesn't apply to articles, documents, feed comments, feed items, files, products, and solutions. If any of these objects are specified in the RETURNING clause, the search is not limited to specific fields; all fields are returned.
convertCurrency(Amount) Optional. If an organization is multicurrency enabled, converts currency fields to the user's currency.
RETURNING FieldSpec Optional. Information to return in the search result. List of one or more objects and, within each object, list of one or more fields, with optional values to filter against. If unspecified, then the search results contain the IDs of all objects found.
WITH DivisionFilter Optional. If an organization uses divisions, filters all search results based on values for the Division field.
WITH DATA CATEGORY DataCategorySpec Optional. If an organization uses Salesforce Knowledge articles or answers, filters all search results based on one or more data categories.
LIMIT n Optional. Specifies the maximum number of rows returned in the text query, up to 200. If unspecified, the default is 200, the largest number of rows that can be returned.
Note
SOSL statements cannot exceed 10,000 characters. For SOSL statements that exceed this maximum length, the API returns an MALFORMED_SEARCH exception code; no result rows are returned.
© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.