How can I order the results of a SOSL
query by relevance, meaning the result with the most matches of my OR term first?
I have an Apex class that uses SOSL to find potential duplicates for a new bug ticket. It splits the new tickets title:
Killer function fails with limits
into single words, removes stop words and plural 's':
Killer function fail limit
converts it to a soql query term:
Killer* OR function* OR fail* OR limit*
and passes it to a SOSL query:
FIND :termString
RETURNING Defect__c(Name, Details__c, Severity__c, Release__r.Name, Sprint__r.Name, StageOfCompletion__c, FoundInRelease__c
WHERE Project__c = :projId
ORDER BY LastModifiedDate DESC)
LIMIT 20