3

I wrote a SOSL query:

FIND {Joe} IN NAME FIELDS RETURNING Contact

It returned me couple of records in which one of them had Mark John in the name field of the Contact. Reading the SOSL documentation mentioned below it seems like Find{Joe} should be an exact match and not a fuzzy match.

FIND {SearchQuery} Use the required FIND clause of a SOSL query to specify the word or phrase to search for. A search query includes the literal word or phrase and can also include wildcards and logical operators (AND, OR, and AND NOT). A search query includes: The literal text (single word or a phrase) to search for Optionally, Wildcards Optionally, logical Operators, including grouping parentheses

I am trying to understand why does Find{Joe} returns 'Mark John'. Isn't Find{Joe} an exact match criteria? It does not even have wildcard to return Johnenter image description here

  • Joe is not even a fuzzy search for Mark or John so maybe something else is going on. For contact it also searches AssistantName, FirstNameLocal, LastNameLocal When you put 'Joe' in global search doe it return 'Mark John'? – Eric Jun 10 '17 at 4:04
  • Yeah , it does return Mark John when I search in global search for Joe – SfdcBat Jun 10 '17 at 4:27
  • When I searched for FIND {Joe} IN ALL FIELDS it returned only contacts with Name such as John Bond,John Smith,Mark John,Joe Smith, Jack Rogers – SfdcBat Jun 10 '17 at 4:35
  • 1
    Is AssistantName specified for Mark? That too gets searched as a name field according to the documentation. – Adrian Larson Jun 10 '17 at 13:42
  • No , assistantName is not specified for any of the contact that I get in the result of the SOSL. – SfdcBat Jun 10 '17 at 14:00
0

I encountered this same issue myself. I could not find any thing to substantiate that SOSL does any kind of Phonetic matching, but it obviously does, and in your use-case not a very good match.

I did find a workaround for this by enclosing the term in double quotes.

"Joe" should give you your expected results.

| improve this answer | |
-1

For that, you need to search like this

find {Joe} in All Fields Returning contact(Name where Name Like 'Joe%')

or

find {Joe} in All Fields Returning contact(Name where FirstName = 'Joe')

or

find {Joe%} in All Fields Returning contact(Name) 
| improve this answer | |
  • While I'm sure this would work, it doesn't really explain why SOSL is returning results that apparently don't contain "Joe" in them. IN ALL FIELDS may also not be appropriate in this situation. – Derek F Apr 20 at 12:43

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.