You can use one or more ORDER BY clauses in a SOSL statement.
ORDER BY fieldname [ASC | DESC] [NULLS [first | last]]
| Syntax | Description |
|---|---|
| ASC or DESC | Ascending (ASC) or descending (DESC) order of the results. Default order is ascending. |
| NULLS | Order null records at the beginning (first) or end (last) of the results. By default, NULL values are sorted last in ascending order and first in descending order. |
FIND {MyName} RETURNING Account(Name, Id ORDER BY Id)FIND {MyContactName} RETURNING Contact(Name, Id ORDER BY Name), Account(Description, Id ORDER BY Description)The following search returns a result with account records in alphabetical order by name, sorted in descending order, with accounts that have null names appearing last:
FIND {MyAccountName} IN NAME FIELDS RETURNING Account(Name, Id ORDER BY Name DESC NULLS last)