About SOSL

SOSL allows you to specify the following for source objects:Pass the entire SOSL expression in the search parameter of the search() call.
Note
If your organization has relationship queries enabled, SOSL supports SOQL relationship queries.

Comparing SOSL and SOQL

Like Salesforce Object Query Language (SOQL), SOSL allows you to search your organization’s Salesforce data for specific information. Unlike SOQL, which can only query one object at a time, a single SOSL query can search all objects—including custom objects—to which you have access. The API executes the search within the specified scope and returns to you only the information that is available to you based on the user permissions under which your application has logged in.

Designing Efficient Text Searches

If your searches are too general, they will be slow and return too many results. Use the following to write more efficient searches:

Search Scope

The search() call searches most objects (including custom objects) and text fields to which you have access. It does not search the following objects and fields:

Note the following implementation tips:
  • The search() call provides synonym matching, stop words, stemming, and spell correction for articles. In most cases, the search() call does not provide specialized search features such as synonym matching or stop words.
  • 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.