I have a contact with name Test Contact in the Org.
I run the SOSL like below in Query Editor and able to get results of contacts containing Test in their name:
Find {*Test*} IN ALL FIELDS RETURNING Contact(Id,Name,Email)
I am working on a test class.
In the test class, I have created a contact with FirstName as Test and LastName as Contact.
I have tried to run SOSL as below ways but not able to get any result:
1.
List<List<sObject>> searchResults = [Find '{*Test*}' IN ALL FIELDS RETURNING Contact(Id,Name,Email)];
2.
String searchTextWithWildCards = '*Test*';
List<List<sObject>> searchResults = [Find :searchTextWithWildCards IN ALL FIELDS RETURNING Contact(Id,Name,Email)];
3.
String searchTextWithWildCards = '%Test%';
List<List<sObject>> searchResults = [Find :searchTextWithWildCards IN ALL FIELDS RETURNING Contact(Id,Name,Email)];
What am I missing here?