Similar to this issue, I would like to add the fivestar results to the Apache Solr search results. I know how to add field to the Solr index, so that's not the problem. The problem is that the Fivestar results don't seem to available anywhere in the $node object (which is passed to hook_apachesolr_update_index()). According to fivestar_nodeapi(), the form is added to the node when it is being viewed, but not at other times. To make this searchable, it would need to be added to the search index when $op == 'update index'. The question is, what function would I call to pass that value to Solr? Would it be fivestar_get_votes, or something else?
Then, once I have the value indexed and I want to display the results, I'm assuming I would call theme_fivestar_summary in my theme function or template.
Does all that sound correct?
Thanks.
Comments
Comment #1
shaneonabike commentedI've been working on a solution for this and might have it completed within the next few days here. Are you still looking for that solution?
Comment #2
intraclast commentedHi, I'm trying to find out how to do the samething (display my fivestar ratings within apache solr search results). Did either of you manage to get this working?
Thanks
Comment #3
nvl.sateesh commentedHi Shane,
I am looking for such solution. Please post if you have it.
I am using Apachesolr and would liek to integrate fivestar results in sorting as well as results....
thanks and have a great day!
Comment #4
shaneonabike commentedWe did actually get this working (apologise for not posting sooner just have some pretty big deadlines). Also, sorry this isn't in an actual module but I think it'll still help you out regardless.
Apache Solr related code
Creating a block code
Update Solr Data after each rating
Code for template.php
Comment #5
intraclast commentedThanks very much for posting this. I'm pretty new to coding in drupal and how it all works but this is definitely pointing me in the right direction here. Now I just have to learn how to make a module... (I said I was new :) )
Comment #6
shaneonabike commentedI also posted a more complete description here - http://www.koumbit.org/en/articles/how-integrate-fivestar-ratings-apache...
Comment #7
seanbAfter placing the code from #4 in a module, I found that there is a function missing: olesolr_apachesolr_facets()
I guess this is a custom function as I can't find any olesolr module and you have another function named olesolr_votingapi_results().
Could you please post the code for olesolr_apachesolr_facets() or maybe describe what this function is supposed to return? If I get this all working I will post the complete module code here.
Comment #8
incaic commentedThanks @ShaneOnABike! Code from #4 worked for me.
FYI: Your koumbit.org link from #6 is not open to the public.
@seanB, I renamed the missing function
to
and defined it as
Also, olesolr_votingapi_results() should be renamed to modsolr_votingapi_results().
Comment #9
ericduran commentedI'm going to close this issue as it's not really a fivestar issue.
Feel free to open it up again if needed.
Comment #10
shaneonabike commentedSorry about the issues with the article posting I didn't see that comment until now...
http://www.koumbit.org/en/articles/how-integrate-fivestar-ratings-apache... is now live if people need that. Also the changes above are correct.
Comment #11
incaic commented@ShaneOnABike
FYI The code sections are unreadable. They have html tags spelled out inside of them.
Comment #13
BeaPower commentedwill this work with views too?
Comment #14
Zereff commentedHello! Sorry, but I don't understood where your paste this snippets. How you create module or change old modules.
Tell me please where you paste all snippets for search by fivestar sorting? I view your article about integrated fivestar rating in apachesolr, but I don't understood where to put your snippets in which module? May be I need to create new module and think about how to use your code?
Comment #15
BeaPower commentedWill this work for search api solr search?
Comment #16
dave reidRestoring status as per #9.