If you query from multiple objects the SOSL query returns a List<List<SObject>>
, with each inner List sorted by relevance inside.
I want to return a combined mixed list sorted by relevance between all objects.. one way to do it would be just combine all these results in apex and then sort by date (but date isn't exactly relevance) - is there a better way to do that, preferably in a single query?
Let's say I have these results:
Case
Case 1
Case 2
Task
Task 1
Task 2
I want them returned as (or whatever, based on relevance among all results combined):
Task 2
Case 1
Case 2
Task 1
SOSL format: Why does SOSL return a List of a List of sObjects in Apex?
Single object SOSL query: How to order SOSL results by relevance
WITH RELEVANCE
in the SOSL Syntax so that information may not be available. Will be interesting to see if there is an answer...