1

Trying to search multiple terms in SOSL in APEX. I tried this singular, of course works:

[FIND 'searchOne' IN ALL FIELDS RETURNING ACCOUNT]

But these don't work:

  • [FIND 'searchOne' OR 'searchTwo' ....
  • [FIND {'searchOne','searchTwo'} ....
  • [FIND (searchOne', 'searchTwo') ....

Error is:

'(' not expected (or something..etc)

My goal is bulkification and searching a value in an Encrypted Field. I want to be able to get all matching records based on a set of terms.

1 Answer 1

2

In Apex, it's just a normal string:

[FIND 'searchOne or searchTwo' in all fields ...

This syntax is slightly different than the API, which is probably where the confusion is coming from. You can also use quotation marks (") to group terms, etc, just like you can in normal SOSL.

[FIND '"searchOne" or "searchTwo"' in all fields ...
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .