I've created a view and selected it for my field, but when I do a search none of the results listed in the views preview are returned.

I've selected several search fields and have 5 total. Is there something I'm missing? Does it require relationships/contextual filters? I haven't been able to find any guides on this.

Comments

arosboro’s picture

Project: Inline Entity Form » Entity reference
Version: 7.x-1.1 » 7.x-1.0

Investigating this a little further shows that the result of view::execute_display on line 111 of plugins/selection/EntityReference_SelectionHandler_Views.class.php, is returning an empty array. However, view::preview renders output for all rows matching the current filters (observed while creating view in preview area).

$entityreference_options passed to views_plugin_display::set_option are as follows:

match (String, 13 characters ) John Doe
match_operator (String, 11 characters ) STARTS_WITH
limit (Integer) 10
ids (NULL)

arosboro’s picture

$conditions set by looping through $style_options['search_fields'] show that only nid is set when you output $conditions->conditions();

#conjunction (String, 2 characters ) OR
0 (Array, 3 elements)
field (String, 8 characters ) node.nid
value (String, 6 characters ) John Doe%
operator (String, 4 characters ) LIKE

$this->view->field[$field_alias]->field_alias on line 82 of views/entityreference_plugin_display.inc is returning 'nid'. Which is why it's comparing to the field node.nid. Not sure if this is expected behavior, but the search isn't going to return results unless it finds the table for the field I'm trying to search on.

MustangGB’s picture

Issue summary: View changes
Status: Active » Closed (outdated)