Subject MATCHES returns irrelevant messages
I have a board where all the messages have subjects that are just dates like 2019-06-12.
I used to find the relevant messages by querying subject MATCHES '<date>'.
Now,however, I'm getting results where the subject will be a completely different date from the query.
Any suggestions?
You missed the single quotes around that:
Change
SELECT subject FROM messages WHERE subject MATCHES "Negative balance"
to
SELECT subject FROM messages WHERE subject MATCHES '"Negative balance"'.
But when I tried that the url still showed " in it.
This doesn't work, as you can see the double quotes aren't encoded when pasting in the url:
http://www.paypal-community.com/ppl/api/2.0/search?q=SELECT%20subject%20FROM%20messages%20WHERE%20category.id%20%3D%20%27EN%27%20AND%20subject%20MATCHES%20%27"Negative%20balance"%27%20AND%20is_solution%3Dtrue%20LIMIT%205
So I escaped the " and then it returns 0 results.
However, when I remove the other criteria it does seem to only return messages where the subject contains negative and balance:
http://www.paypal-community.com/ppl/api/2.0/search?q=SELECT%20subject%20FROM%20messages%20WHERE%20subject%20MATCHES%20%27\%22Negative%20balance\%22%27%20
{"status":"success","message":"","http_code":200,"data":{"type":"messages","list_item_type":"message","size":25,"items":[{"type":"message","subject":"What does it mean when paypal sends you a negative balance alert?"},{"type":"message","subject":"I have a negative balance, my bank has been removed and I cannot re-link it"},{"type":"message","subject":"Negative balance requirements"},{"type":"message","subject":"How do I solve a negative balance when Paypal refuses to retry the direct debit to my bank?"},{"type":"message","subject":"Negative balance"},{"type":"message","subject":"Negative balance"},{"type":"message","subject":"Cannot use paypal account after negative balance"},{"type":"message","subject":"Negative Balance in Account - Seller"},{"type":"message","subject":"Negative Balance"},{"type":"message","subject":"Waiting on a refund and now have a negative balance"},{"type":"message","subject":"my paypal balance is negative"},{"type":"message","subject":"PayPal took money from bank account and negative balance"},{"type":"message","subject":"negative balance"},{"type":"message","subject":"Negative balance"},{"type":"message","subject":"Negative Bank Balance"},{"type":"message","subject":"Negative balance"},{"type":"message","subject":"Account limitation issue due to negative balance."},{"type":"message","subject":"Card confirmed but cannot add money to resolve negative balance"},{"type":"message","subject":"Negative balance coz someone 'wrongly' sent me money and got refunded!"},{"type":"message","subject":"Help transfer funds/negative balance"},{"type":"message","subject":"negative balance"},{"type":"message","subject":"Refund from Negative Balance"},{"type":"message","subject":"PayPal REST API /v1/reporting/balances balance_detail returning wrong negative balance"},{"type":"message","subject":"Re: My PayPal got hacked & they refused to side with me, now have negative balance of -$380usd"},{"type":"message","subject":"Negative balance disappered but nothing was refunded?"}], "next":"SELECT subject FROM messages WHERE subject MATCHES '\"Negative balance\"' OFFSET 25","next_cursor":"AAAADCuD_h8uURyNxZRl37BWy0wdplAE8SvazLANsE1TTUUuhCcZ1sNV-VvNlO_DIZSGa1mrh_7Nd4qmSgSBq7g9kB37oeI9aA"},"metadata":{}}
In other words
- make sure yo use both single and double quotes
- uri encode your query
- escape the double quotes with \, if they're not converted