SOSL Explained
Unlike SOQL, which queries a single object at a time (plus related objects through relationship fields), SOSL performs a full-text search across multiple objects in a single call. It returns a list of lists (one list per sObject type searched) and supports FIND clauses with wildcards, proximity operators, and logical operators (AND, OR, AND NOT). SOSL searches run against Salesforce's search index, which is updated asynchronously, so very recently created records may not appear immediately.
SOSL is ideal for global search scenarios, such as finding a contact name that might appear across Leads, Contacts, and custom objects. In Apex, SOSL queries count against a separate governor limit (20 per transaction) from SOQL. Developers frequently use SOSL in search pages, de-duplication utilities, and knowledge-base lookups where the target object is unknown ahead of time.
Related Salesforce Terms
SOQL
SOQL (Salesforce Object Query Language) is the query language used to search and retrieve records from Salesforce's database.
Apex
Apex is Salesforce's proprietary, strongly-typed programming language used to execute custom business logic on the Lightning Platform.
Custom Object
A Custom Object is a user-defined database table in Salesforce that stores data specific to your organization's unique business needs.