-
Notifications
You must be signed in to change notification settings - Fork 464
SOSLRecipes
pozil edited this page Nov 14, 2024
·
15 revisions
Demonstrates how to use SOSL. SOSL is used for full text, and fuzzier text searching.
More on the difference between SOQL and SOSL: https://sfdc.co/soql-sosl
Group Data Recipes
Demonstrates the syntax for a SOSL search.
Note: SOSL Cannot be unit tested directly - you must use
Test.setFixedSearchResults()
See SOSLRecipes_Tests.cls for more information
public static List<List<SObject>> basicSOSLSearch()
List<List<SObject>>
System.debug(SOSLRecipes.basicSOSLSearch());
Demonstrates how to write a SOSL query that searches only name fields
public static List<List<SObject>> nameFieldSearch()
List<List<SObject>>
System.debug(SOSLRecipes.nameFieldSearch());