Rewrite extended query to be a single enormous join

* Basically, use separate queries to find all possible Dashboard-visible
  objects, then intersect with search results via "ON" condition.  This
  is substantially more efficient than subqueries in the WHERE clause
  or nested JOINs.