Index: modules/aggregator/aggregator.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v
retrieving revision 1.37
diff -u -p -r1.37 aggregator.pages.inc
--- modules/aggregator/aggregator.pages.inc	9 Oct 2009 00:59:55 -0000	1.37
+++ modules/aggregator/aggregator.pages.inc	16 Nov 2009 17:02:05 -0000
@@ -85,20 +85,60 @@ function aggregator_page_category($arg1,
 function aggregator_feed_items_load($type, $data = NULL) {
   $items = array();
   $range_limit = 20;
+
   switch ($type) {
     case 'sum':
-      $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC', 0, $range_limit);
+      $query = db_select('aggregator_item', 'i');
+      $query->join('aggregator_feed', 'f', 'i.fid = f.fid');
+      $query->addField('f', 'title', 'ftitle');
+      $query->addField('f', 'link', 'flink');
+      $result = $query->fields('i')
+        ->orderBy('i.timestamp', 'DESC')
+        ->orderBy('i.iid', 'DESC')
+        ->range(0, $range_limit)
+        ->addTag('aggregator_filter')
+        ->addMetaData('context', 'sum')
+        ->execute();
       break;
+
     case 'source':
-      $result = db_query_range('SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC', 0, $range_limit, array(':fid' => $data->fid));
+      $result = db_select('aggregator_item', 'i')
+        ->fields('i')
+        ->condition('fid', $data->fid)
+        ->orderBy('i.timestamp', 'DESC')
+        ->orderBy('i.iid', 'DESC')
+        ->range(0, $range_limit)
+        ->addTag('aggregator_filter')
+        ->addMetaData('context', 'source')
+        ->execute();
       break;
+
     case 'category':
-      $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = :cid ORDER BY timestamp DESC, i.iid DESC', 0, $range_limit, array(':cid' => $data['cid']));
+      $query = db_select('aggregator_category_item', 'c');
+      $query->leftJoin('aggregator_item', 'i', 'c.iid = i.iid');
+      $query->leftJoin('aggregator_feed', 'f', 'i.fid = f.fid');
+      $query->addField('f', 'title', 'ftitle');
+      $query->addField('f', 'link', 'flink');
+      $result = $query->fields('i')
+        ->condition('c.cid', $data['cid'])
+        ->orderBy('i.timestamp', 'DESC')
+        ->orderBy('i.iid', 'DESC')
+        ->range(0, $range_limit)
+        ->addTag('aggregator_filter')
+        ->addMetaData('context', 'category')
+        ->execute();
       break;
   }
 
   foreach ($result as $item) {
-    $item->categories = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = :iid ORDER BY c.title', array(':iid' => $item->iid))->fetchAll();
+    $query = db_select('aggregator_category_item', 'ci');
+    $query->leftJoin('aggregator_category', 'c', 'ci.cid = c.cid');
+    $item->categories = $query->fields('c', array('title', 'cid'))
+      ->condition('ci.iid', $item->iid)
+      ->orderBy('c.title')
+      ->execute()
+      ->fetchAll();
+
     $items[] = $item;
   }
 
@@ -301,18 +341,40 @@ function template_preprocess_aggregator_
  * Menu callback; displays all the feeds used by the aggregator.
  */
 function aggregator_page_sources() {
-  $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.description, f.image ORDER BY last DESC, f.title');
+  $query = db_select('aggregator_feed', 'f');
+  $query->leftJoin('aggregator_item', 'i', 'f.fid = i.fid');
+  $query->addExpression('MAX(i.timestamp)', 'last');
+  $result = $query->fields('f', array('fid', 'title', 'description', 'image'))
+    ->groupBy('f.fid')
+    ->groupBy('f.title')
+    ->groupBy('f.description')
+    ->groupBy('f.image')
+    ->orderBy('last', 'DESC')
+    ->orderBy('f.title')
+    ->execute();
 
   $output = '';
+  $range_limit = variable_get('aggregator_summary_items', 3);
+
   foreach ($result as $feed) {
     // Most recent items:
     $summary_items = array();
-    if (variable_get('aggregator_summary_items', 3)) {
-      $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = :fid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':fid' => $feed->fid));
+
+    if ($range_limit) {
+      $items = db_select('aggregator_item', 'i')
+        ->fields('i', array('title', 'timestamp', 'link'))
+        ->condition('i.fid', $feed->fid)
+        ->orderBy('i.timestamp', 'DESC')
+        ->range(0, $range_limit)
+        ->addTag('aggregator_filter')
+        ->addMetaData('context', 'source')
+        ->execute();
+
       foreach ($items as $item) {
         $summary_items[] = theme('aggregator_summary_item', array('item' => $item));
       }
     }
+
     $feed->url = url('aggregator/sources/' . $feed->fid);
     $output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $feed));
   }
@@ -325,17 +387,40 @@ function aggregator_page_sources() {
  * Menu callback; displays all the categories used by the aggregator.
  */
 function aggregator_page_categories() {
-  $result = db_query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {aggregator_item} i ON ci.iid = i.iid GROUP BY c.cid, c.title, c.description');
+  $query = db_select('aggregator_category', 'c');
+  $query->leftJoin('aggregator_category_item', 'ci', 'c.cid = ci.cid');
+  $query->leftJoin('aggregator_item', 'i', 'ci.iid = i.iid');
+  $result = $query->fields('c', array('cid', 'title', 'description'))
+    ->groupBy('c.cid')
+    ->groupBy('c.title')
+    ->groupBy('c.description')
+    ->execute();
 
   $output = '';
+  $range_limit = variable_get('aggregator_summary_items', 3);
+
   foreach ($result as $category) {
-    if (variable_get('aggregator_summary_items', 3)) {
+    if ($range_limit) {
       $summary_items = array();
-      $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = :cid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':cid' => $category->cid));
+
+      $query = db_select('aggregator_category_item', 'ci');
+      $query->leftJoin('aggregator_item', 'i', 'i.iid = ci.iid');
+      $query->leftJoin('aggregator_feed', 'f', 'i.fid = f.fid');
+      $query->addField('f', 'title', 'feed_title');
+      $query->addField('f', 'link', 'feed_link');
+      $items = $query->fields('i', array('title', 'timestamp', 'link'))
+        ->condition('ci.cid', $category->cid)
+        ->orderBy('i.timestamp', 'DESC')
+        ->range(0, $range_limit)
+        ->addTag('aggregator_filter')
+        ->addMetaData('context', 'category')
+        ->execute();
+
       foreach ($items as $item) {
         $summary_items[] = theme('aggregator_summary_item', array('item' => $item));
       }
     }
+
     $category->url = url('aggregator/categories/' . $category->cid);
     $output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $category));
   }
@@ -349,17 +434,40 @@ function aggregator_page_categories() {
 function aggregator_page_rss() {
   $result = NULL;
   // arg(2) is the passed cid, only select for that category.
-  if (arg(2)) {
-    $category = db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = :cid', array(':cid' => arg(2)))->fetchObject();
-    $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = :cid ORDER BY timestamp DESC, i.iid DESC', 0, variable_get('feed_default_items', 10), array(':cid' => $category->cid));
+  $cid = arg(2);
+
+  if ($cid) {
+    $category =
+      db_select('aggregator_category', 'c')
+        ->fields('c', array('cid', 'title'))
+        ->condition('cid', $cid)
+        ->execute()
+        ->fetchObject();
+
+    $query = db_select('aggregator_category_item', 'ci');
+    $query->leftJoin('aggregator_item', 'i', 'i.iid = ci.iid');
+    $query->leftJoin('aggregator_feed', 'f', 'i.fid = f.fid');
+    $query->condition('ci.cid', $category->cid);
   }
   // Or, get the default aggregator items.
   else {
     $category = NULL;
-    $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC', 0, variable_get('feed_default_items', 10));
+    $query = db_select('aggregator_item', 'i');
+    $query->join('aggregator_feed', 'f', 'i.fid = f.fid');
   }
 
-  $feeds = $result->fetchAll();
+  $query->addField('f', 'title', 'ftitle');
+  $query->addField('f', 'link', 'flink');
+
+  $feeds = $query->fields('i')
+    ->orderBy('i.timestamp', 'DESC')
+    ->orderBy('i.iid', 'DESC')
+    ->range(0, variable_get('feed_default_items', 10))
+    ->addTag('aggregator_filter')
+    ->addMetaData('context', 'feed')
+    ->execute()
+    ->fetchAll();
+
   return theme('aggregator_page_rss', array('feeds' => $feeds, 'category' => $category));
 }
 
Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.341
diff -u -p -r1.341 blog.module
--- modules/blog/blog.module	8 Nov 2009 10:02:41 -0000	1.341
+++ modules/blog/blog.module	16 Nov 2009 17:02:05 -0000
@@ -145,6 +145,8 @@ function _blog_post_exists($account) {
     ->condition('status', 1)
     ->range(0, 1)
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'blog')
     ->execute()
     ->fetchField();
 }
@@ -173,6 +175,8 @@ function blog_block_view($delta = '') {
       ->orderBy('created', 'DESC')
       ->range(0, 10)
       ->addTag('node_access')
+      ->addTag('node_filter')
+      ->addMetaData('context', 'blog')
       ->execute();
 
     if ($node_title_list = node_title_list($result)) {
Index: modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.24
diff -u -p -r1.24 blog.pages.inc
--- modules/blog/blog.pages.inc	1 Nov 2009 21:26:44 -0000	1.24
+++ modules/blog/blog.pages.inc	16 Nov 2009 17:02:05 -0000
@@ -39,6 +39,8 @@ function blog_page_user($account) {
     ->orderBy('created', 'DESC')
     ->limit(variable_get('default_nodes_main', 10))
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'blog')
     ->execute()
     ->fetchCol();
 
@@ -88,6 +90,8 @@ function blog_page_last() {
     ->orderBy('created', 'DESC')
     ->limit(variable_get('default_nodes_main', 10))
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'blog')
     ->execute()
     ->fetchCol();
 
@@ -120,6 +124,8 @@ function blog_feed_user($account) {
     ->orderBy('created', 'DESC')
     ->range(0, variable_get('feed_default_items', 10))
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'feed')
     ->execute()
     ->fetchCol();
 
@@ -140,6 +146,8 @@ function blog_feed_last() {
     ->orderBy('created', 'DESC')
     ->range(0, variable_get('feed_default_items', 10))
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'feed')
     ->execute()
     ->fetchCol();
 
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.524
diff -u -p -r1.524 book.module
--- modules/book/book.module	8 Nov 2009 10:02:41 -0000	1.524
+++ modules/book/book.module	16 Nov 2009 17:02:05 -0000
@@ -259,6 +259,8 @@ function book_block_view($delta = '') {
     $select->addField('node', 'title');
     $select->condition('nid', $node->book['bid']);
     $select->addTag('node_access');
+    $select->addTag('node_filter');
+    $select->addMetaData('context', 'book');
     $title = $select->execute()->fetchField();
     // Only show the block if the user has view access for the top-level node.
     if ($title) {
@@ -340,6 +342,8 @@ function book_get_books() {
       $query->orderBy('ml.weight');
       $query->orderBy('ml.link_title');
       $query->addTag('node_access');
+      $query->addTag('node_filter');
+      $query->addMetaData('context', 'book');
       $result2 = $query->execute();
       foreach ($result2 as $link) {
         $link['href'] = $link['link_path'];
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.804
diff -u -p -r1.804 comment.module
--- modules/comment/comment.module	12 Nov 2009 06:46:44 -0000	1.804
+++ modules/comment/comment.module	16 Nov 2009 17:02:05 -0000
@@ -382,6 +382,8 @@ function comment_get_recent($number = 10
   $query->innerJoin('node', 'n', 'n.nid = c.nid');
   $query->innerJoin('node_comment_statistics', 'ncs', 'ncs.nid = c.nid');
   $query->addTag('node_access');
+  $query->addTag('comment_filter');
+
   $comments = $query
     ->fields('c')
     ->condition('ncs.comment_count', 0, '>')
@@ -681,13 +683,17 @@ function comment_get_thread($node, $mode
   $query
     ->condition('c.nid', $node->nid)
     ->addTag('node_access')
+    ->addTag('comment_filter')
+    ->addMetaData('node', $node)
     ->limit($comments_per_page);
 
   $count_query = db_select('comment', 'c');
   $count_query->addExpression('COUNT(*)');
   $count_query
     ->condition('c.nid', $node->nid)
-    ->addTag('node_access');
+    ->addTag('node_access')
+    ->addTag('comment_filter')
+    ->addMetaData('node', $node);
 
   if (!user_access('administer comments')) {
     $query->condition('c.status', COMMENT_PUBLISHED);
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.533
diff -u -p -r1.533 forum.module
--- modules/forum/forum.module	12 Nov 2009 20:30:22 -0000	1.533
+++ modules/forum/forum.module	16 Nov 2009 17:02:05 -0000
@@ -547,7 +547,10 @@ function forum_block_save($delta = '', $
 function forum_block_view($delta = '') {
   $query = db_select('forum_index', 'f')
     ->fields('f')
-    ->addTag('node_access');
+    ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'forum_index');
+
   switch ($delta) {
     case 'active':
       $title = t('Active forum topics');
@@ -661,6 +664,8 @@ function forum_get_forums($tid = 0) {
       ->condition('status', 1)
       ->groupBy('tid')
       ->addTag('node_access')
+      ->addTag('node_filter')
+      ->addMetaData('context', 'forum')
       ->execute()
       ->fetchAllAssoc('tid');
   }
@@ -692,6 +697,8 @@ function forum_get_forums($tid = 0) {
       ->orderBy('last_comment_timestamp', 'DESC')
       ->range(0, 1)
       ->addTag('node_access')
+      ->addTag('node_filter')
+      ->addMetaData('context', 'forum')
       ->execute()
       ->fetchObject();
 
@@ -723,6 +730,8 @@ function _forum_topics_unread($term, $ui
     ->condition('n.created', NODE_NEW_LIMIT, '>')
     ->isNull('h.nid')
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'forum')
     ->execute()
     ->fetchField();
 }
@@ -749,6 +758,8 @@ function forum_get_topics($tid, $sortby,
   $query
     ->condition('f.tid', $tid)
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'forum_index')
     ->orderBy('f.sticky', 'DESC')
     ->orderByHeader($forum_topic_list_header)
     ->orderBy('f.last_comment_timestamp', 'DESC')
@@ -758,6 +769,8 @@ function forum_get_topics($tid, $sortby,
   $count_query->condition('f.tid', $tid);
   $count_query->addExpression('COUNT(*)');
   $count_query->addTag('node_access');
+  $count_query->addTag('node_filter');
+  $count_query->addMetaData('context', 'forum_index');
 
   $query->setCountQuery($count_query);
   $result = $query->execute();
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1168
diff -u -p -r1.1168 node.module
--- modules/node/node.module	15 Nov 2009 00:23:57 -0000	1.1168
+++ modules/node/node.module	16 Nov 2009 17:02:05 -0000
@@ -1528,6 +1528,8 @@ function node_search_execute($keys = NUL
   $query
     ->condition('n.status', 1)
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'search')
     ->searchExpression($keys, 'node');
 
   // Insert special keywords.
@@ -2024,6 +2026,8 @@ function node_feed($nids = FALSE, $chann
       ->orderBy('n.created', 'DESC')
       ->range(0, variable_get('feed_default_items', 10))
       ->addTag('node_access')
+      ->addTag('node_filter')
+      ->addMetaData('context', 'feed')
       ->execute()
       ->fetchCol();
   }
@@ -2119,7 +2123,9 @@ function node_page_default() {
     ->orderBy('created', 'DESC')
     ->extend('PagerDefault')
     ->limit(variable_get('default_nodes_main', 10))
-    ->addTag('node_access');
+    ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'default');
 
   $nids = $select->execute()->fetchCol();
 
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.323
diff -u -p -r1.323 poll.module
--- modules/poll/poll.module	8 Nov 2009 10:02:41 -0000	1.323
+++ modules/poll/poll.module	16 Nov 2009 17:02:05 -0000
@@ -141,7 +141,9 @@ function poll_block_view($delta = '') {
       ->condition('p.active', 1)
       ->orderBy('n.created', 'DESC')
       ->range(0, 1)
-      ->addTag('node_access');
+      ->addTag('node_access')
+      ->addTag('node_filter')
+      ->addMetaData('context', 'poll');
 
     $record = $select->execute()->fetchObject();
     if ($record) {
Index: modules/poll/poll.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v
retrieving revision 1.25
diff -u -p -r1.25 poll.pages.inc
--- modules/poll/poll.pages.inc	8 Nov 2009 10:02:41 -0000	1.25
+++ modules/poll/poll.pages.inc	16 Nov 2009 17:02:05 -0000
@@ -32,7 +32,9 @@ function poll_page() {
     ->groupBy('n.created')
     ->extend('PagerDefault')
     ->limit($polls_per_page)
-    ->addTag('node_access');
+    ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'poll');
   $select->setCountQuery($count_select);
   $queried_nodes = $select->execute()
     ->fetchAllAssoc('nid');
Index: modules/profile/profile.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v
retrieving revision 1.21
diff -u -p -r1.21 profile.pages.inc
--- modules/profile/profile.pages.inc	9 Oct 2009 01:00:02 -0000	1.21
+++ modules/profile/profile.pages.inc	16 Nov 2009 17:15:20 -0000
@@ -40,6 +40,8 @@ function profile_browse() {
       ->condition('v.fid', $field->fid)
       ->condition('u.access', 0, '<>')
       ->condition('u.status', 0, '<>')
+      ->addTag('user_filter')
+      ->addMetaData('context', 'profile')
       ->orderBy('u.access', 'DESC');
 
     // Determine what query to use:
@@ -101,6 +103,8 @@ function profile_browse() {
       ->condition('u.status', 0, '>')
       ->condition('u.access', 0, '>')
       ->orderBy('u.access', 'DESC')
+      ->addTag('user_filter')
+      ->addMetaData('context', 'profile')
       ->limit(20)
       ->execute()
       ->fetchCol();
Index: modules/statistics/statistics.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v
retrieving revision 1.324
diff -u -p -r1.324 statistics.module
--- modules/statistics/statistics.module	8 Nov 2009 10:02:41 -0000	1.324
+++ modules/statistics/statistics.module	16 Nov 2009 17:02:05 -0000
@@ -256,6 +256,8 @@ function statistics_title_list($dbfield,
   if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) {
     $query = db_select('node', 'n');
     $query->addTag('node_access');
+    $query->addTag('node_filter');
+    $query->addMetaData('context', 'statistics');
     $query->join('node_counter', 's', 'n.nid = s.nid');
     $query->join('users', 'u', 'n.uid = u.uid');
 
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.538
diff -u -p -r1.538 taxonomy.module
--- modules/taxonomy/taxonomy.module	13 Nov 2009 09:24:06 -0000	1.538
+++ modules/taxonomy/taxonomy.module	16 Nov 2009 17:02:05 -0000
@@ -103,6 +103,8 @@ function taxonomy_select_nodes($tid, $pa
   }
   $query = db_select('taxonomy_index', 't');
   $query->addTag('node_access');
+  $query->addTag('node_filter');
+  $query->addMetaData('context', 'taxonomy');
   if ($pager) {
     $count_query = clone $query;
     $count_query->addExpression('COUNT(t.nid)');
Index: modules/tracker/tracker.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v
retrieving revision 1.28
diff -u -p -r1.28 tracker.pages.inc
--- modules/tracker/tracker.pages.inc	1 Nov 2009 21:26:44 -0000	1.28
+++ modules/tracker/tracker.pages.inc	16 Nov 2009 17:02:05 -0000
@@ -30,6 +30,8 @@ function tracker_page($account = NULL, $
   // while keeping the correct order.
   $nodes = $query
     ->addTag('node_access')
+    ->addTag('node_filter')
+    ->addMetaData('context', 'tracker')
     ->fields('t', array('nid', 'changed'))
     ->condition('t.published', 1)
     ->orderBy('t.changed', 'DESC')
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1080
diff -u -p -r1.1080 user.module
--- modules/user/user.module	13 Nov 2009 10:21:50 -0000	1.1080
+++ modules/user/user.module	16 Nov 2009 17:08:10 -0000
@@ -801,7 +801,9 @@ function user_search_execute($keys = NUL
   // Replace wildcards with MySQL/PostgreSQL wildcards.
   $keys = preg_replace('!\*+!', '%', $keys);
   $query = db_select('users')->extend('PagerDefault');
-  $query->fields('users', array('name', 'uid', 'mail'));
+  $query->fields('users', array('name', 'uid', 'mail'))
+    ->addTag('user_filter')
+    ->addMetaData('context', 'search');
   if (user_access('administer users')) {
     // Administrators can also search in the otherwise private email field.
     $query->condition(db_or()->
