diff --git apachesolr_views.module apachesolr_views.module
index d294441..0df0154 100644
--- apachesolr_views.module
+++ apachesolr_views.module
@@ -31,6 +31,93 @@ function theme_apachesolr_views_term_titles($term_names) {
 }
 
 /**
+ * Implementation of hook_menu().
+ */
+function apachesolr_views_menu() {
+  $items = array();
+  $items['apachesolr-views/nodereference/autocomplete'] = array(
+    'title' => 'Nodereference autocomplete',
+    'page callback' => 'apachesolr_views_nodereference_autocomplete',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK
+  );
+  $items['apachesolr-views/userreference/autocomplete'] = array(
+    'title' => 'Userreference autocomplete',
+    'page callback' => 'apachesolr_views_userreference_autocomplete',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK
+  );
+  return $items;
+}
+
+/**
+ * Custom nodereference autocomplete
+ */
+function apachesolr_views_nodereference_autocomplete($field_name, $string = '') {
+  $fields = content_fields();
+  $field = $fields[$field_name];
+  $match = isset($field['widget']['autocomplete_match']) ? $field['widget']['autocomplete_match'] : 'contains';
+  $matches = array();
+
+  $references = _nodereference_potential_references($field, $string, $match, array(), 10);
+  foreach ($references as $id => $row) {
+    // Add a class wrapper for a few required CSS overrides.
+    $matches[$row['title']] = '<div class="reference-autocomplete">'. $row['rendered'] . '</div>';
+  }
+  drupal_json($matches);
+}
+
+/**
+ * Custom nodereference autocomplete
+ */
+function apachesolr_views_userreference_autocomplete($field_name, $string = '') {
+  $fields = content_fields();
+  $field = $fields[$field_name];
+  $match = isset($field['widget']['autocomplete_match']) ? $field['widget']['autocomplete_match'] : 'contains';
+  $matches = array();
+
+  $references = _userreference_potential_references($field, $string, $match, array(), 10);
+  foreach ($references as $id => $row) {
+    // Add a class wrapper for a few required CSS overrides.
+    $matches[$row['title']] = '<div class="reference-autocomplete">'. $row['rendered'] . '</div>';
+  }
+  drupal_json($matches);
+}
+
+function apachesolr_views_handler_filter_cleanup($element) {
+  static $done = array();
+  
+  if (!isset($done[$element['#name']])) {
+    $done[$element['#name']] = TRUE;
+    $solr = apachesolr_static_response_cache();
+    if (isset($solr)) {
+      $options = $element['#options'];
+      $selectedoptions = $element['#value'];
+      if (isset($element['#vid'])) {
+        $elname = $element['#vid'];
+      }
+      else {
+        $elname = $element['#name'];
+      }
+      $facet = $solr->facet_counts->facet_fields->{$elname};
+      if (isset($facet)) {
+        foreach ($facet as $k => $f) {
+          $facets[$k] = $k;
+        }
+      }
+      if (isset($facet) && isset($facets)) {
+        $element['#options'] = array_intersect_key($options, $facets);
+      }
+      else {
+        $element['#options'] = array_intersect_key($options, $selectedoptions);
+      }
+    }
+  }
+
+  return $element;
+}
+
+/**
  * Implementation of hook_apachesolr_entities().
  * This is done for apachesolr_search module.
  */
diff --git apachesolr_views.views.inc apachesolr_views.views.inc
index 27a4d2b..29179e3 100644
--- apachesolr_views.views.inc
+++ apachesolr_views.views.inc
@@ -60,6 +60,12 @@ function apachesolr_views_views_handlers() {
       'apachesolr_views_handler_field_snippet' => array(
         'parent' => 'views_handler_field',
       ),
+      'apachesolr_views_handler_field_nodereference' => array(
+        'parent' => 'views_handler_field',
+      ),
+      'apachesolr_views_handler_field_userreference' => array(
+        'parent' => 'views_handler_field',
+      ),
       'apachesolr_views_handler_filter_tid' => array(
         'parent' => 'views_handler_filter_term_node_tid',
       ),
@@ -84,6 +90,12 @@ function apachesolr_views_views_handlers() {
       'apachesolr_views_handler_filter_boolean' => array(
         'parent' => 'views_handler_filter_boolean_operator',
       ),
+      'apachesolr_views_handler_filter_nodereference' => array(
+        'parent' => 'content_handler_filter_many_to_one',
+      ),
+      'apachesolr_views_handler_filter_userreference' => array(
+        'parent' => 'content_handler_filter_many_to_one',
+      ),
       'apachesolr_views_handler_sort' => array(
         'parent' => 'views_handler_sort',
       ),
@@ -315,7 +327,7 @@ function apachesolr_views_views_data() {
       // TODO: can we make use of CCK's mapping already and just override
       // the query part???
       $options = content_allowed_values(content_fields($field['field_name']));
-      if (!empty($options)) {
+      if (!empty($options) && $field['type'] != 'nodereference' && $field['type'] != 'userreference') {
         $label = (isset($field['widget']['label'])) ? t($field['widget']['label']) : '';
         $data['apachesolr_' . $base_table][apachesolr_index_key($field)] = array(
           'title' => $label,
@@ -330,6 +342,34 @@ function apachesolr_views_views_data() {
           ),
         ); // end: array
       } // end: if
+      elseif ($field['type'] == 'nodereference') {
+       $data['apachesolr_' . $base_table][apachesolr_index_key($field)] = array(
+         'title' => t($field['field_name']),
+         'help' => t('CCK Mapping for @fieldname', array('@fieldname' => $field['field_name'])),
+         'field' => array(
+           'handler' => 'apachesolr_views_handler_field_nodereference',
+         ),
+         'filter' => array(
+           'handler' => 'apachesolr_views_handler_filter_nodereference',
+           'cck_field' => $field,
+           'label' => t($field['field_name']),
+         ),
+       );
+      }
+      elseif ($field['type'] == 'userreference') {
+       $data['apachesolr_' . $base_table][apachesolr_index_key($field)] = array(
+         'title' => t($field['field_name']),
+         'help' => t('CCK Mapping for @fieldname', array('@fieldname' => $field['field_name'])),
+         'field' => array(
+           'handler' => 'apachesolr_views_handler_field_userreference',
+         ),
+         'filter' => array(
+           'handler' => 'apachesolr_views_handler_filter_userreference',
+           'cck_field' => $field,
+           'label' => t($field['field_name']),
+         ),
+       );
+      }
     } // end: foreach
   } // end: foreach
   
diff --git handlers/apachesolr_views_handler_field_nodereference.inc handlers/apachesolr_views_handler_field_nodereference.inc
new file mode 100644
index 0000000..c6d7152
--- /dev/null
+++ handlers/apachesolr_views_handler_field_nodereference.inc
@@ -0,0 +1,27 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * provides a field handler for the snippet coming from the ApacheSolr search engine
+ */
+class apachesolr_views_handler_field_nodereference extends views_handler_field {
+  function query() {
+    $this->query->add_field($this->real_field);
+  }
+
+  function render($doc) {
+    if (is_array($doc->{$this->real_field})) {
+      $values = $doc->{$this->real_field};
+    }
+    else {
+      $values = array($doc->{$this->real_field});
+    }
+    
+    $titles = array();
+    foreach ($values as $nid) {
+      $titles[] = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
+    }
+    return implode(', ', $titles);
+  }
+}
diff --git handlers/apachesolr_views_handler_field_userreference.inc handlers/apachesolr_views_handler_field_userreference.inc
new file mode 100644
index 0000000..703a9c6
--- /dev/null
+++ handlers/apachesolr_views_handler_field_userreference.inc
@@ -0,0 +1,27 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * provides a field handler for the snippet coming from the ApacheSolr search engine
+ */
+class apachesolr_views_handler_field_userreference extends views_handler_field {
+  function query() {
+    $this->query->add_field($this->real_field);
+  }
+
+  function render($doc) {
+    if (is_array($doc->{$this->real_field})) {
+      $values = $doc->{$this->real_field};
+    }
+    else {
+      $values = array($doc->{$this->real_field});
+    }
+    
+    $names = array();
+    foreach ($values as $uid) {
+      $names[] = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
+    }
+    return implode(', ', $names);
+  }
+}
diff --git handlers/apachesolr_views_handler_filter_author.inc handlers/apachesolr_views_handler_filter_author.inc
index ccab333..b2160e9 100644
--- handlers/apachesolr_views_handler_filter_author.inc
+++ handlers/apachesolr_views_handler_filter_author.inc
@@ -14,7 +14,7 @@ class apachesolr_views_handler_filter_author extends views_handler_filter_user_n
     
     if (empty($uids) && ($this->options['exposed'] && empty($this->options['expose']['optional']))) {
       if (!$not) {
-        $this->query->add_filter('nid', apachesolr_views_query::escape_term('-1'));
+        $this->query->add_filter('uid', apachesolr_views_query::escape_term('-1'));
       }
     }
     else {
diff --git handlers/apachesolr_views_handler_filter_nodereference.inc handlers/apachesolr_views_handler_filter_nodereference.inc
new file mode 100644
index 0000000..4fa8c19
--- /dev/null
+++ handlers/apachesolr_views_handler_filter_nodereference.inc
@@ -0,0 +1,253 @@
+<?php
+// $Id$
+
+/**
+ * Class for filtering by nodereference nid.
+ */
+class apachesolr_views_handler_filter_nodereference extends content_handler_filter_many_to_one {
+
+  public function query() {
+
+    $not = $this->operator == 'not in';
+    $nids = $this->value;
+
+    if (empty($nids)) {
+      if (!$not) {
+        $this->query->add_filter($this->real_field, apachesolr_views_query::escape_term('-1'));
+      }
+    }
+    else {
+      foreach ($nids as $nid) {
+        $filter_string .= " OR $nid";
+      }
+      
+      // Construct a small subquery.
+      $filter_string = substr($filter_string, 4);
+      $filter_string = "($filter_string)";
+//print_r('query::' . $this->real_field . '::' . $filter_string . '::' . $not);
+      // Add it to the query.
+      $this->query->add_filter($this->real_field, $filter_string, $not);
+    }
+  }
+
+  function has_extra_options() {
+    return TRUE;
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['type'] = array('default' => 'textfield');
+    return $options;
+  }
+
+  function extra_options_form(&$form, &$form_state) {
+    $form['markup_start'] = array(
+      '#value' => '<div class="views-left-40">',
+    );
+    $form['type'] = array(
+      '#type' => 'radios',
+      '#title' => t('Selection type'),
+      '#options' => array('select' => t('Dropdown'), 'textfield' => t('Autocomplete')),
+      '#default_value' => $this->options['type'],
+    );
+    $form['markup_end'] = array(
+      '#value' => '</div>',
+    );
+  }
+
+  /**
+   * Get allowed values from hook_allowed_values(), if any, or from
+   * content_allowed_values();
+   */
+  function allowed_values() {
+    $options = nodereference_allowed_values(content_fields($this->definition['cck_field']['field_name']));;
+    return (array) $options;
+  }
+
+  function value_form(&$form, &$form_state) {
+    $form['value'] = array();
+
+    if ($this->options['type'] == 'select') {
+      $this->get_value_options();
+      $options = $this->value_options;
+      $default_value = (array) $this->value;
+
+      $which = 'all';
+      if (!empty($form['operator'])) {
+        $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
+      }
+      if (!empty($form_state['exposed'])) {
+        $identifier = $this->options['expose']['identifier'];
+
+        if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator'])) {
+          // Exposed and locked.
+          $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none';
+        }
+        else {
+          $source = 'edit-' . form_clean_id($this->options['expose']['operator']);
+        }
+
+        if (!empty($this->options['expose']['reduce'])) {
+          $options = $this->reduce_value_options();
+
+          if (empty($this->options['expose']['single']) && !empty($this->options['expose']['optional'])) {
+            $default_value = array();
+          }
+        }
+
+        if (!empty($this->options['expose']['single'])) {
+          if (!empty($this->options['expose']['optional']) && (empty($default_value) || !empty($this->options['expose']['reduce']))) {
+            $default_value = 'All';
+          }
+          else if (empty($default_value)) {
+            $keys = array_keys($options);
+            $default_value = array_shift($keys);
+          }
+          else {
+            $copy = $default_value;
+            $default_value = array_shift($copy);
+          }
+        }
+      }
+
+      if ($which == 'all' || $which == 'value') {
+        if ($this->value_form_type == 'checkboxes') {
+          foreach ($options as $key => $option) {
+            $options[$key] = check_plain($option);
+          }
+        }
+        $form['value'] = array(
+          '#type' => $this->value_form_type,
+          '#title' => $this->value_title,
+          '#options' => $options,
+          '#default_value' => $default_value,
+          // These are only valid for 'select' type, but do no harm to checkboxes.
+          '#multiple' => TRUE,
+          '#size' => count($options) > 8 ? 8 : count($options),
+          '#pre_render' => array('apachesolr_views_handler_filter_cleanup'),
+        );
+        if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+          $form_state['input'][$identifier] = $default_value;
+        }
+
+        if ($which == 'all') {
+          $process = array();
+          if ($this->value_form_type == 'checkboxes' || $this->value_form_type == 'radios') {
+            $process[] = "expand_$this->value_form_type";
+            $form['value']['#prefix'] = '<div id="edit-options-value-wrapper">';
+            $form['value']['#suffix'] = '</div>';
+          }
+          $process[] = 'views_process_dependency';
+          $form['value'] += array(
+            '#process' => $process,
+            '#dependency' => array($source => $this->operator_values(1)),
+          );
+        }
+      }
+
+      if (empty($form_state['exposed'])) {
+        $this->helper->options_form($form, $form_state);
+      }
+    }
+    elseif ($this->options['type'] == 'textfield') {
+      $default = '';
+      if (is_numeric($this->value)) {
+        $default = check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $this->value)));
+        if ($this->options['expose']['show_nid']) {
+          $default .= ' [nid:' . $this->value . ']';
+        }
+      }
+      else {
+        $default = $this->value;
+      }
+      
+      $form['value'] = array(
+        '#title' => $this->value_title,
+        '#type' => 'textfield',
+        '#default_value' => $default,
+      );
+      if ($this->options['expose']['show_nid']) {
+        $form['value']['#autocomplete_path'] = 'nodereference/autocomplete/'. $this->definition['cck_field']['field_name'];
+      }
+      else {
+        $form['value']['#autocomplete_path'] = 'apachesolr-views/nodereference/autocomplete/'. $this->definition['cck_field']['field_name'];
+      }
+    }
+  }
+
+  function value_validate(&$form, &$form_state) {
+    // We only validate if they've chosen the text field style.
+    if ($this->options['type'] != 'textfield') {
+      return;
+    }
+
+    $nid = $this->nodereference_validate($form, $form_state['values']['options']['value']);
+
+    $form_state['values']['options']['value'] = $nid;
+  }
+
+  function exposed_validate(&$form, &$form_state) {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    $identifier = $this->options['expose']['identifier'];
+
+    // We only validate if they've chosen the text field style.
+    if ($this->options['type'] != 'textfield') {
+
+      if ($form_state['values'][$identifier] != 'All')  {
+        $this->validated_exposed_input = (array) $form_state['values'][$identifier];
+      }
+      return;
+    }
+
+    if (empty($this->options['expose']['identifier'])) {
+      return;
+    }
+    $nid = $this->nodereference_validate($form, $form_state['values'][$identifier]);
+    $this->validated_exposed_input = $nid;
+    $form_state['values'][$identifier] = $nid;
+  }
+
+  function nodereference_validate(&$form, $value) {
+    $field = content_fields($this->definition['cck_field']['field_name']);
+    if (!empty($value)) {
+      preg_match('/^(?:\s*|(.*) )?\[\s*nid\s*:\s*(\d+)\s*\]$/', $value, $matches);
+      if (!empty($matches)) {
+        // Explicit [nid:n].
+        list(, $title, $nid) = $matches;
+        if (!empty($title) && ($n = node_load($nid)) && $title != $n->title) {
+          form_error($form['value'], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label']))));
+        }
+      }
+      else {
+        // No explicit nid.
+        $reference = _nodereference_potential_references($field, $value, 'equals', NULL, 1);
+        if (empty($reference)) {
+          form_error($form['value'], t('%name: found no valid post with that title.', array('%name' => t($field['widget']['label']))));
+        }
+        else {
+          $nid = key($reference);
+        }
+      }
+    }
+
+    return $nid;
+  }
+
+  function expose_options() {
+    parent::expose_options();
+    $this->options['expose']['show_nid'] = TRUE;
+  }
+
+  function expose_form_right(&$form, &$form_state) {
+    parent::expose_form_right($form, $form_state);
+    $form['expose']['show_nid'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show nid in text field'),
+      '#description' => t('If checked, the autocomplete field will contain the node id. This can yield more accurate results.'),
+      '#default_value' => !empty($this->options['expose']['show_nid']),
+    );
+  }
+}
diff --git handlers/apachesolr_views_handler_filter_tid.inc handlers/apachesolr_views_handler_filter_tid.inc
index f038e2c..d2cf179 100644
--- handlers/apachesolr_views_handler_filter_tid.inc
+++ handlers/apachesolr_views_handler_filter_tid.inc
@@ -18,7 +18,13 @@ class apachesolr_views_handler_filter_tid extends views_handler_filter_term_node
     }
     
   }
-    
+
+  function value_form(&$form, &$form_state) {
+    parent::value_form($form, $form_state);
+    $form['value']['#pre_render'] = array('apachesolr_views_handler_filter_cleanup');
+    $form['value']['#vid'] = 'im_vid_' . $this->options['vid'];
+  }
+
   function exposed_validate(&$form, &$form_state) {
     
     parent::exposed_validate($form, $form_state);
diff --git handlers/apachesolr_views_handler_filter_userreference.inc handlers/apachesolr_views_handler_filter_userreference.inc
new file mode 100644
index 0000000..79b9222
--- /dev/null
+++ handlers/apachesolr_views_handler_filter_userreference.inc
@@ -0,0 +1,254 @@
+<?php
+// $Id$
+
+/**
+ * Class for filtering by userreference uid.
+ */
+class apachesolr_views_handler_filter_userreference extends content_handler_filter_many_to_one {
+
+  public function query() {
+
+    $not = $this->operator == 'not in';
+    $uids = (array)$this->value;
+
+    if (empty($uids)) {
+      if (!$not) {
+        $this->query->add_filter($this->real_field, apachesolr_views_query::escape_term('-1'));
+      }
+    }
+    else {
+      foreach ($uids as $uid) {
+        $filter_string .= " OR $uid";
+      }
+      
+      // Construct a small subquery.
+      $filter_string = substr($filter_string, 4);
+      $filter_string = "($filter_string)";
+
+      // Add it to the query.
+      $this->query->add_filter($this->real_field, $filter_string, $not);
+    }
+  }
+
+  function has_extra_options() {
+    return TRUE;
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['type'] = array('default' => 'textfield');
+    return $options;
+  }
+
+  function extra_options_form(&$form, &$form_state) {
+    $form['markup_start'] = array(
+      '#value' => '<div class="views-left-40">',
+    );
+    $form['type'] = array(
+      '#type' => 'radios',
+      '#title' => t('Selection type'),
+      '#options' => array('select' => t('Dropdown'), 'textfield' => t('Autocomplete')),
+      '#default_value' => $this->options['type'],
+    );
+    $form['markup_end'] = array(
+      '#value' => '</div>',
+    );
+  }
+
+  /**
+   * Get allowed values from hook_allowed_values(), if any, or from
+   * content_allowed_values();
+   */
+  function allowed_values() {
+    $options = userreference_allowed_values(content_fields($this->definition['cck_field']['field_name']));;
+    return (array) $options;
+  }
+
+  function value_form(&$form, &$form_state) {
+    $form['value'] = array();
+    
+    if ($this->options['type'] == 'select') {
+      $this->get_value_options();
+      $options = $this->value_options;
+      $default_value = (array) $this->value;
+
+      $which = 'all';
+      if (!empty($form['operator'])) {
+        $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator';
+      }
+      if (!empty($form_state['exposed'])) {
+        $identifier = $this->options['expose']['identifier'];
+
+        if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator'])) {
+          // Exposed and locked.
+          $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none';
+        }
+        else {
+          $source = 'edit-' . form_clean_id($this->options['expose']['operator']);
+        }
+
+        if (!empty($this->options['expose']['reduce'])) {
+          $options = $this->reduce_value_options();
+
+          if (empty($this->options['expose']['single']) && !empty($this->options['expose']['optional'])) {
+            $default_value = array();
+          }
+        }
+
+        if (!empty($this->options['expose']['single'])) {
+          if (!empty($this->options['expose']['optional']) && (empty($default_value) || !empty($this->options['expose']['reduce']))) {
+            $default_value = 'All';
+          }
+          else if (empty($default_value)) {
+            $keys = array_keys($options);
+            $default_value = array_shift($keys);
+          }
+          else {
+            $copy = $default_value;
+            $default_value = array_shift($copy);
+          }
+        }
+      }
+
+      if ($which == 'all' || $which == 'value') {
+        if ($this->value_form_type == 'checkboxes') {
+          foreach ($options as $key => $option) {
+            $options[$key] = check_plain($option);
+          }
+        }
+        $form['value'] = array(
+          '#type' => $this->value_form_type,
+          '#title' => $this->value_title,
+          '#options' => $options,
+          '#default_value' => $default_value,
+          // These are only valid for 'select' type, but do no harm to checkboxes.
+          '#multiple' => TRUE,
+          '#size' => count($options) > 8 ? 8 : count($options),
+          '#pre_render' => array('apachesolr_views_handler_filter_cleanup'),
+        );
+        
+        if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
+          $form_state['input'][$identifier] = $default_value;
+        }
+
+        if ($which == 'all') {
+          $process = array();
+          if ($this->value_form_type == 'checkboxes' || $this->value_form_type == 'radios') {
+            $process[] = "expand_$this->value_form_type";
+            $form['value']['#prefix'] = '<div id="edit-options-value-wrapper">';
+            $form['value']['#suffix'] = '</div>';
+          }
+          $process[] = 'views_process_dependency';
+          $form['value'] += array(
+            '#process' => $process,
+            '#dependency' => array($source => $this->operator_values(1)),
+          );
+        }
+      }
+
+      if (empty($form_state['exposed'])) {
+        $this->helper->options_form($form, $form_state);
+      }
+    }
+    elseif ($this->options['type'] == 'textfield') {
+      $default = '';
+      if (is_numeric($this->value)) {
+        $default = check_plain(db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $this->value)));
+        if ($this->options['expose']['show_uid']) {
+          $default .= ' [uid:' . $this->value . ']';
+        }
+      }
+      else {
+        $default = $this->value;
+      }
+      
+      $form['value'] = array(
+        '#title' => $this->value_title,
+        '#type' => 'textfield',
+        '#default_value' => $default,
+      );
+      if ($this->options['expose']['show_uid']) {
+        $form['value']['#autocomplete_path'] = 'userreference/autocomplete/'. $this->definition['cck_field']['field_name'];
+      }
+      else {
+        $form['value']['#autocomplete_path'] = 'apachesolr-views/userreference/autocomplete/'. $this->definition['cck_field']['field_name'];
+      }
+    }
+  }
+
+  function value_validate(&$form, &$form_state) {
+    // We only validate if they've chosen the text field style.
+    if ($this->options['type'] != 'textfield') {
+      return;
+    }
+
+    $uid = $this->userreference_validate($form, $form_state['values']['options']['value']);
+
+    $form_state['values']['options']['value'] = $uid;
+  }
+
+  function exposed_validate(&$form, &$form_state) {
+    if (empty($this->options['exposed'])) {
+      return;
+    }
+
+    $identifier = $this->options['expose']['identifier'];
+
+    // We only validate if they've chosen the text field style.
+    if ($this->options['type'] != 'textfield') {
+
+      if ($form_state['values'][$identifier] != 'All')  {
+        $this->validated_exposed_input = (array) $form_state['values'][$identifier];
+      }
+      return;
+    }
+
+    if (empty($this->options['expose']['identifier'])) {
+      return;
+    }
+    $uid = $this->userreference_validate($form, $form_state['values'][$identifier]);
+    $this->validated_exposed_input = $uid;
+    $form_state['values'][$identifier] = $uid;
+  }
+
+  function userreference_validate(&$form, $value) {
+    $field = content_fields($this->definition['cck_field']['field_name']);
+    if (!empty($value)) {
+      preg_match('/^(?:\s*|(.*) )?\[\s*uid\s*:\s*(\d+)\s*\]$/', $value, $matches);
+      if (!empty($matches)) {
+        // Explicit [uid:n].
+        list(, $title, $uid) = $matches;
+        if (!empty($title) && ($n = user_load($uid)) && $title != $n->name) {
+          form_error($form['value'], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label']))));
+        }
+      }
+      else {
+        // No explicit uid.
+        $reference = _userreference_potential_references($field, $value, 'equals', NULL, 1);
+        if (empty($reference)) {
+          form_error($form['value'], t('%name: found no valid post with that title.', array('%name' => t($field['widget']['label']))));
+        }
+        else {
+          $uid = key($reference);
+        }
+      }
+    }
+
+    return $uid;
+  }
+
+  function expose_options() {
+    parent::expose_options();
+    $this->options['expose']['show_uid'] = TRUE;
+  }
+
+  function expose_form_right(&$form, &$form_state) {
+    parent::expose_form_right($form, $form_state);
+    $form['expose']['show_uid'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show uid in text field'),
+      '#description' => t('If checked, the autocomplete field will contain the node id. This can yield more accurate results.'),
+      '#default_value' => !empty($this->options['expose']['show_uid']),
+    );
+  }
+}
