When defining a targetQuery against Salesforce, the queryFilter is parsed to SOQL for searching against Salesforce itself. However, for complex queries, the resulting SOQL does not work (although it is valid SQL (not SOQL)).
As an example, the following targetQuery:
Generates the following SOQL WHERE clause:
Which is rejected by Salesforce as Malformed:
The correct SOQL would be: