I am writing a text search query with SOSL to match exact phrase. But it's giving results like in a wildcard search.


Results :

  • 001xxxxxxxxxx CCMSI
  • 001xxxxxxxxxx CCMSI
  • 001xxxxxxxxxx CCMSI

Result set is same for CMSI, CCMS* as well.

When I don't use wildcard, I expect the exact text to be matched and returned results. Isn't it the way SOSL works? I noted few related questions in the forum but this behavior is still confused.


SOSL does exact match of the word by default. The results you got is the expected behavior of SOSL. It checked for the CCMS but it isn't full word matching as you want it to be.

The workaround I can think of is

  • let SOSL return all the results then iterate over those results and compare the value that you want to search against a particular field
  • OR if possible you can switch to SOQL and use exact full word match if it can solve your purpose.
  • So what would be the difference between {CCMS} and {CCMS*} ? – highfive Dec 8 '16 at 10:51
  • I think the first sentence you mean does not exact match is it? – highfive Dec 9 '16 at 6:50

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.