+ Start a Discussion

SOSL Case Sensitivity

Hello All,


I have an issue with SOSL. On my visualforce page there is a form for submitting a search. When the search is initiated the following SOSL call is run using a string submitted from the visualforce page and placed into a variable called urlSearch.


Now according to the online documentation the search is not supposed to be case sensitive, however the search string submitted much match case-wise a string within the Event object, otherwise there will be not returned results. So if the search string is 'email' and within the set of Event records there is no 'email' yet there is 'Email', i will get no results returned.



List<List<sObject>> searchList = Search.query('FIND \''+ String.escapeSingleQuotes(urlSearch) + '*\' IN ALL FIELDS RETURNING Event (AccountId, WhatId, Id, ActivityDateTime, Type, Subject, WhoId, Who.Name WHERE WhatId = \''+String.escapeSingleQuotes(urlID)+'\' OR AccountId = \''+String.escapeSingleQuotes(urlID)+'\')');


From the online help:


Searches are evaluated from left to right and use Unicode (UTF-8) encoding. Text searches are case-insensitive. For example, searching for Customercustomer, or CUSTOMER

 all return the same results.


Has anyone else come accross this issue. Any advice is appreciated. Thanks.


Hmm.  Doesn't happen for me - I've got a number of events with the text 'Test' and 'test' present and they are all returned regardless of the case of the search.  I'm wondering if its specific to the field that your 'Email' text is in - when you get a match, which field or fields of the returned objects contain the text?


Hello Bob,


The fields that i am targeting on the Event object are Subject and Description. For both fields the case sensitivity is a problem.