Newer Version Available

This content describes an older version of this product. View Latest

SOSL Limits

The search engine applies limits to the number of records analyzed at each stage of the search process. Due to this, users don’t always find all possible matching results because the record that they’re looking for falls outside of the results set limit.
This image illustrates the order that the search engine processes SOSL searches. In the illustration, each color represents an object, and each raindrop represents some records. The numbers correspond to this flow:
  1. The search engine looks for matches to the search term across a maximum of 2,000 records (this limit starts with API version 28.0).
  2. SOSL applies different limits for a given object or situation. If the search is for a single object, the full record limit is applied. If the search is global across multiple objects, each object has individual limits that total 2,000 records.
  3. Admins (users with the View All Data permission) see the full set of results returned.
  4. For all other users, SOSL applies user permission filters. Individual users see only those records that they have access to. Results sets and order vary by the user issuing the search and can change throughout the day as records are added or removed from the index.

truncation and sharing rules can limit results users see

Example

Joe Smith, a sales executive at Acme, Inc., wants to find the account record for Industrial Computing. He types Industrial into the search bar. Because so many records match the search term Industrial, a limit is imposed on the results. Unfortunately for Joe, the record he wanted is outside the limit. This concept is illustrated in the image as the single raindrop outside of the filter.

Because Joe used a global search, limits are applied to each object type to make up the 2,000 record limit. The illustration shows five blue raindrops going into the filter, but only three make it to the next stage. If Joe limited his search to just one object, the limit would apply to only that object, increasing the chance that the record he wanted would be returned.

Joe retries his search by typing Industrial Computing San Francisco. With a more specific search term, the search engine is able to return better matches, even with the same limits applied. In this scenario, the record Joe’s looking for is one of the blue raindrops that makes it from the top of the filter all the way through to Joe’s search results page.

To avoid search crowding and truncation:

Encourage users to use more specific search terms
Searches work best when users enter a unique search term. Acme Company San Francisco returns more relevant results than Acme.
Encourage users to narrow the search scope
When users are on the search results page, limit the search scope to the object type for the record desired. The search is rerun. Potentially, users could see more results, because the full result set limit is applied against a single object.
Create list views
Create a list view for a specific set of contacts, documents, or other object records that you search for repeatedly. List views have no limits to the number of records and have a set order. Sharing rules are also applied.

SOSL Limits for External Objects

  • To include an external object in SOSL and Salesforce searches, enable search on both the external object and the external data source. However, syncing always overwrites the external object’s search status to match the search status of the external data source.
  • Only text, text area, and long text area fields on external objects can be searched. If an external object has no searchable fields, searches on that object return no records.
  • External objects don’t support the following.
    • INCLUDES operator
    • LIKE operator
    • EXCLUDES operator
    • toLabel() function
  • External objects also don’t support Salesforce Knowledge-specific clauses, including the following.
    • UPDATE TRACKING clause
    • UPDATE VIEWSTAT clause
    • WITH DATA CATEGORY clause
  • External objects must be specified explicitly in a RETURNING clause to be returned in search results. For example:
    1FIND {MyProspect} RETURNING MyExternalObject, MyOtherExternalObject
The following limits apply only to the OData 2.0 and 4.0 adapters for Salesforce Connect.
  • The OData adapters for Salesforce Connect don’t support logical operators in a FIND clause. We send the entire search query string to the external system as a case-sensitive single phrase after removing all ASCII punctuation characters except hyphens (-). For example, FIND {MyProspect OR “John Smith”} searches for the exact phrase “MyProspect OR John Smith”.
The following limits apply only to custom adapters for Salesforce Connect.
  • The convertCurrency() function isn’t supported in SOSL queries of external objects.
  • WITH clauses aren’t supported in SOSL queries of external objects.