You need to sign in to do that
Don't have an account?
Shilpa Kamble
Dynamic SOSL with hyphen in search string
Does anyone know How to search the string with hyphen(-) in dynamic SOSL?
returning 0 results.
string searchStr = 'EG-0006201'; string str = 'FIND \''+searchStr+'*\'IN ALL FIELDS REturning Event_Registration__c (Id,Name)'; system.debug('str='+str); List<List <sObject>> Rslt= search.query(str ); system.debug('Rslt='+Rslt);
returning 0 results.
Yes, I have record in salesforce database.
This query does't gove any error in salesforce apex, but if I try this in developer console I get following error there is problem with '-' hyphen symbol in search string.
How do I so that?
thanks
[? & | ! { } [ ] ( ) ^ ~ * : \ " ' + -]
Reserved characters, if specified in a text search, must be escaped (preceded by the backslash \ character) in order to be properly interpreted. An error occurs if you do not precede reserved characters with a backslash. This is true even if the SearchQuery is enclosed in double quotes.
For example, to search for the following text:
insert a backslash before each reserved character: i hope it helps you
thanks