Hi,
I created a view as entity reference. I use this view in a node field (entity reference) to select users.
I managed to create the user reference list as a combination from multiple fields.
All users are listed in the following way:
Firstname Lastname, City

Now, I have a large list of users. Therefor I decided to use an autocomplete style of the entity reference field to select my users.
Now search lists all users correctly, if I just text from ONE of the field above. But I need to combine the values of the combined fields to find the correct user.

E.g. list contains Max Mustermann, Berlin

I can find this user by searching for Ma OR Must OR Ber.
But I also want to search for
Max Mu
OR
Mustermann, Berlin

I tried including a global textfield and adding all my needed fields as tokens. I also activated the search option for this global textfield in the views settings.

But it doesn't work. Can anyone give me a hint?

Comments

mcpuddin’s picture

I have this same issue and this looks like a physical limitation of Entity Reference Auto Complete when using a view. ERAC is not looking at how you "rewrite output" in views but is actually looking directly at the query and comparing the search string individually with the view's SQL command. The only work around I can see is:
* some how find a module that can concat fields ( couldn't find one myself )
* rewrite ERAC
* reroute the autocomplete search result to go to your own module where you can manipulate it yourself with the way you want

vistree’s picture

Hm, so this could the reason, why a global views field does not work?! As this is created on the fly and is not stored in the database?
I can't belief that we need to use an extra field (like computed field https://drupal.org/project/computed_field) to solve this problem ...