Example Text Searches

Look for joe anywhere in the system. Return the IDs of the records where joe is found.

FIND {joe}

Look for the name Joe Smith anywhere in the system, in a case-insensitive search. Return the IDs of the records where Joe Smith is found.

FIND {Joe Smith}

Look for the name Joe Smith in the name field of a lead, return the ID field of the records.

FIND {Joe Smith}
IN Name Fields
RETURNING lead

Look for the name Joe Smith in the name field of a lead and return the name and phone number.

FIND {Joe Smith}
IN Name Fields
RETURNING lead(name, phone)

Look for the name Joe Smith in the name field of a lead and return the name and phone number of any matching record that was also created in the current fiscal quarter.

FIND {Joe Smith}
IN Name Fields
RETURNING lead (name, phone Where createddate = THIS_FISCAL_QUARTER) 

Look for the name Joe Smith or Joe Smythe in the name field of a lead or contact and return the name and phone number. If an opportunity is called Joe Smith or Joe Smythe, the opportunity should not be returned.

FIND {"Joe Smith" OR "Joe Smythe"}
IN Name Fields
RETURNING lead(name, phone), contact(name, phone)

Wildcards:

FIND {Joe Sm*}
FIND {Joe Sm?th*}

Delimiting “and” and “or” as literals when used alone:

FIND {"and" or "or"}   
FIND {"joe and mary"}   
FIND {in}
FIND {returning}
FIND {find}

Escaping special characters & | ! ( ) { } [ ] ^ “ ~ * ? : \ '

FIND {right brace \}}
FIND {asterisk \*}
FIND {question \?}
FIND {single quote  \'}
FIND {double quote  \"}
Note
Apex requires that you surround SOQL and SOSL statements with square brackets in order to use them on the fly. Additionally, Apex script variables and expressions can be used if preceded by a colon (:).
© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.