diff --git a/docroot/sites/all/modules/contrib/entityreference/entityreference.module b/docroot/sites/all/modules/contrib/entityreference/entityreference.module
index 14d932a..f241b14 100644
--- a/docroot/sites/all/modules/contrib/entityreference/entityreference.module
+++ b/docroot/sites/all/modules/contrib/entityreference/entityreference.module
@@ -691,6 +691,7 @@ function entityreference_field_widget_info() {
     'settings' => array(
       'match_operator' => 'CONTAINS',
       'size' => 60,
+      'hide_ids' => FALSE,
       // We don't have a default here, because it's not the same between
       // the two widgets, and the Field API doesn't update default
       // settings when the widget changes.
@@ -705,6 +706,7 @@ function entityreference_field_widget_info() {
     'settings' => array(
       'match_operator' => 'CONTAINS',
       'size' => 60,
+      'hide_ids' => FALSE,
       // We don't have a default here, because it's not the same between
       // the two widgets, and the Field API doesn't update default
       // settings when the widget changes.
@@ -755,6 +757,12 @@ function entityreference_field_widget_settings_form($field, $instance) {
       '#element_validate' => array('_element_validate_integer_positive'),
       '#required' => TRUE,
     );
+    $form['hide_ids'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Hide ids'),
+      '#description' => t('If your target entities have unique labels you may choose not to have the ids shown to the user. Note that this setting will make it impossible to reference entities with non-unique labels!'),
+      '#default_value' => $settings['hide_ids'],
+    );
   }
 
   return $form;
@@ -828,7 +836,7 @@ function entityreference_field_widget_form(&$form, &$form_state, $field, $instan
 
     foreach ($entities as $entity_id => $entity_item) {
       $label = $handler->getLabel($entity_item);
-      $key = "$label ($entity_id)";
+      $key = $instance['widget']['settings']['hide_ids'] ? $label : "$label ($entity_id)";
       // Labels containing commas or quotes must be wrapped in quotes.
       if (strpos($key, ',') !== FALSE || strpos($key, '"') !== FALSE) {
         $key = '"' . str_replace('"', '""', $key) . '"';
@@ -1040,7 +1048,7 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
     $tags_typed = drupal_explode_tags($string);
     $tag_last = drupal_strtolower(array_pop($tags_typed));
     if (!empty($tag_last)) {
-      $prefix = count($tags_typed) ? implode(', ', $tags_typed) . ', ' : '';
+      $prefix = count($tags_typed) ? drupal_implode_tags($tags_typed) . ', ' : '';
     }
   }
   else {
@@ -1056,14 +1064,14 @@ function entityreference_autocomplete_callback_get_matches($type, $field, $insta
     // Loop through the products and convert them into autocomplete output.
     foreach ($entity_labels as $values) {
       foreach ($values as $entity_id => $label) {
-        $key = "$label ($entity_id)";
+        $key = $instance['widget']['settings']['hide_ids'] ? $label : "$label ($entity_id)";
         // Strip things like starting/trailing white spaces, line breaks and tags.
         $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($key)))));
         // Names containing commas or quotes must be wrapped in quotes.
         if (strpos($key, ',') !== FALSE || strpos($key, '"') !== FALSE) {
           $key = '"' . str_replace('"', '""', $key) . '"';
         }
-        $matches[$prefix . $key] = '<div class="reference-autocomplete">' . $label . '</div>';
+        $matches[$prefix . $key] = '<div class="reference-autocomplete">' . $key . '</div>';
       }
     }
   }
diff --git a/docroot/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php b/docroot/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
index 902c55c..835c24b 100644
--- a/docroot/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
+++ b/docroot/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
@@ -159,6 +159,9 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
     $options = array();
     $entity_type = $this->field['settings']['target_type'];
 
+    // Remove escape formatting.
+    $match = trim(str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $match)));
+
     $query = $this->buildEntityFieldQuery($match, $match_operator);
     if ($limit > 0) {
       $query->range(0, $limit);
diff --git a/docroot/sites/all/modules/contrib/entityreference/views/entityreference_plugin_display.inc b/docroot/sites/all/modules/contrib/entityreference/views/entityreference_plugin_display.inc
index f13e88a..768db97 100644
--- a/docroot/sites/all/modules/contrib/entityreference/views/entityreference_plugin_display.inc
+++ b/docroot/sites/all/modules/contrib/entityreference/views/entityreference_plugin_display.inc
@@ -73,6 +73,7 @@ class entityreference_plugin_display extends views_plugin_display {
       $conditions = db_or();
 
       // Build the condition using the selected search fields
+      $fields = array();
       foreach ($style_options['search_fields'] as $field_alias) {
         if (!empty($field_alias)) {
 
@@ -86,9 +87,10 @@ class entityreference_plugin_display extends views_plugin_display {
           }
           // Add an OR condition for the field
           $conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');
+          $fields[] = $field['table'] . '.' . $field['field'];
         }
       }
-
+      $conditions->where("CONCAT(" . implode(", ' - ', ", $fields) . ") LIKE :value ESCAPE '\\\\'", array(':value' => $value));
       $this->view->query->add_where(NULL, $conditions);
     }
 
