1

When I query SOSL with multiple RETURNING objects, the result comes as a list of lists, each for a different sObjectType, each sorted by default by the "relevance" of each record in the result set.

Is it possible to combine these per-object results into a single list, while keeping the cross-object relevance sort order?

The goal is to be able to search across multiple sObjectTypes and take the top N (5-10) most relevant results, regardless of the sObjectType.

0

SOSL doesn't provide a relevance index, so there's no way to perfectly guarantee they'll be in descending order, and it also doesn't provide a way to get a collated list across all objects. There simply isn't an API for it. You could choose the show the first one or two items from each list (the most relevant), but there's no way to know their relative ordering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.