Hi,
Yes, you can write SOSL inside triggers. Below are some points about SOSL :
SOSL is a search language in salesforce and the important feature is that Unlike SOQL, we can search in multiple objects at same time using SOSL. In SOQL, we can query only one object at a time but in SOSL, We can search for some specified string like ‘testString’ in multiple objects at the same time.
We can search for some specified string like ‘testString’ in multiple objects at the same time.
We can mention in which fields of all the sObjects,we want to search for the string specified.
The SOSL query start with the keyword ‘FIND’.
You can specify, which fields to return for each object mentioned in SOSL query. Suppose you have performed search on three objects Account, Contact & Opportunity. Then you can mention like, for list returned with Account results only (Name, Industry) fields should be returned, and for Contacts results (firstName, lastName) should be returned and similarly for Opportunity.
The result of SOSL is a list of lists of sObjects “List<List<sObject>>”.
The returned result contains the list of sObjects in the same order as order mentioned in SOSL query.
If a SOSL query does not return any records for a specified sObject type, then search results include an empty list for that sObject.
The search string should be at least two characters long.
Hope this helps !