
I have a simple entityreference views created that I was hoping to use as the feed for an autocomplete entityreference.
That view have two fields, title and another textfield that is configured as multiple values in the entity I am referencing.
I was hoping to be able to search for either field but that's not working. Even more, if I select only the multiple feed nothing is being found.
I have tracked the issue down to entityreference/views/entityreference_plugin_display.inc:75 (7.x-1.0)
// Build the condition using the selected search fields
foreach ($style_options['search_fields'] as $field_alias) {
if (!empty($field_alias)) {
// Get the table and field names for the checked field
$field = $this->view->query->fields[$this->view->field[$fild_alias]->field_alias];
// Add an OR condition for the field
$conditions->condition($field['table'] . '.' . $field['field'], $value, 'LIKE');
}
}
Apparently, the field_alias of this specific field is 'nid' while the real alias of the query in my case is 'field_data_field_nombre_field_nombre_value', this would be probably reproduceable by using any multiple feed and trying to use it for searching.
I was hoping to fix it, but as it seems that I need to dive deep into views core to see why this is happening I probably won't be able to do that right now, so hoping to get some help/advice on this.
Comments
Comment #1
dave reidI believe this is a duplicate of #1691612: Autocomplete is searching only on entity properties (not fields).
Comment #2
hanoiiyup, that fixes it.