I am building a drupal site using Views, search API module and user-points module.

I created the "database server", and indexed many fields of nodes.

I created a search page using views and the search API, that present content (image, title etc.) In addition, I want to add to every content in this search view the name of the author that wrote it, his author picture and the current total points of that specific author.
I add a RELATIONSHIPS to the view: "Indexed Content: Author".

Unfortunately, I can't find a way to add the author picture and the current total point to my view. Can somebody advice how to do that?

Comments

edenb’s picture

Title: Can't find User points in a search API view » Search API module - doesn't have author picture field and userpoints field
Issue summary: View changes
drunken monkey’s picture

delvalle’s picture

Status: Closed (duplicate) » Active

I think it's not really duplicated (the part of the picture field yes, but not the userpoints part). I also want to use userpoints fields (in my case, for ordering the view, not for showing userpoints values).

Just to be sure, I've applied the last patch of https://www.drupal.org/node/2224645#comment-8721331 and the userpoints fields are still not showing in my Search API view (the picture field now it's showing, but I don't need it).

If it's better to open a different issue just for the userpoints part, please tell me.

P.D: I don't know if it's relevant, but I'm using Search API with a Solr server and the index I'm using is of User type (the view is a list of users, ordered by their total userpoints).

drunken monkey’s picture

Title: Search API module - doesn't have author picture field and userpoints field » Cannot add userpoints field in Views

Ah, that's of course something different, yes. Sorry for closing this too quickly!

Hm, so you can (and do) index the userpoints, but can't display them in the view? That's really strange, normally they both should go hand in hand. I know it's a bit of a stupid question, but are you sure it's not there? Have you looked through the whole Views "Add fields" form (without filtering to a group)?
If you are sure, and you really are indexing the userpoints, try clearing the Views cache and see if that produces any warnings from the search_api_views module. Otherwise, I wouldn't really know where to look for this.

Also, have you tried with more recent versions of the Search API module?

delvalle’s picture

No, I don't think I have userpoints indexed. At least, nothing regarding userpoints appears in the fields page of the index configuration (/admin/config/search/search_api/index/MYINDEX/fields).

I can find userpoints in the "Add fields" form of all my other views, but in the Search API views userpoints are not showing at all.

If I'm the only one experiencing this problem with userpoints and search API views, it's perfectly possible that it's not a bug, but something I've done wrong in my configuration of the view or in the user index. A step-by-step guide would be wonderful if that's the case.

drunken monkey’s picture

Status: Active » Fixed

If you don't have them indexed, then how do you sort by them?

the view is a list of users, ordered by their total userpoints

That's what had me confused. If the Userpoints field doesn't appear in the Search API settings at all, then the answer is easy: Userpoints probably doesn't properly integrate with the Entity API. Ask in their issue queue to add the necessary hooks (you can also just re-open and move this issue), that should help.

See also the Search API FAQs.

delvalle’s picture

I was explaining what I was trying to achieve, not what I have (if I could achieve a view sorted by their total userpoints, everything would be OK for me and I wouldn't have reopened this issue). Sorry if I explained myself poorly.

Anyway, thanks a lot for pointing me in the right direction! I will open the issue in the Userpoints queue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.