Reimplement is:watched to inline filter query trees

Instead of recursively executing the user's watched notifications
inline the query parse tree as part of the current query.  This allows
an index such as Lucene to execute the entire set of notification
filters, avoiding unnecessary joins through the database.

Change-Id: Id55ec1b84aff8bed99db748de7c5f7332c62fbda
3 files changed