I'm using Restforce and their example for looking for a string is this:

client.search('FIND {bar}')

I'd like to extend to look for a specific email address like this:

client.search('FIND {a@a.com}')

The problem is that this search is returning a lot of other records that don't match the string a@a.com at all! What am I doing wrong?


Not sure exactly why this search string is being interpreted as you're seeing, but using double quotes should give you the right matches:

client.search('FIND {"a@a.com"}')
  • I have a problem when the query string is 'a+a@a.com'. It says it's a MALFORMED_SEARCH. Do you know what kind of escaping I need to do to make it right? What if I want to cover all possible invalid symbols for the query? – user3827303 Feb 10 '15 at 5:48
  • Reserved characters such as + need to be escaped with a backslash, and you'll need to escape that backslash for Ruby, so your query should be something like client.search('FIND {"a\\+a@a.com"}') – metadaddy Feb 10 '15 at 20:41

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.