2

Trying to do a SOSL query to find object matches for one of two variables. The following query is very simplified for easy reading. Any help is appreciated.

String queryString = 'FIND :var1 OR :var2 IN ALL FIELDS RETURNING Account(Name);
2

Yes, you can use OR operator in SOSL as well but variable expression can't be used this way as far as I know:

This Example Works:

List<List<sObject>> l = [FIND '"Jhon" OR "Doe"'
                     IN Name Fields
                     RETURNING Account(name, phone)];

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.