Escape query terms when querying rules core