Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have already read this issue:
#387050: Apache solr and Votingapi
But it looks like it is only targeted at the module "ApacheSolr Integration".
It would be nice if on Search_API/Facet_API we had a facet for listing nodes by minimum votes, minimum rating, etc.
Comment | File | Size | Author |
---|---|---|---|
#7 | Extend-Voting-API-ratings-to-Search-API-1443050-7.patch | 1.69 KB | kyletaylored |
Comments
Comment #1
chirhotec CreditAttribution: chirhotec commentedSubscribing.
I'm using Fivestar on top of Voting API, and really need the ability to filter / sort using Search API and Facet API. I'm not sure which module would be responsible for that, but I'd think it would belong in here and be available to all modules that build on top of Voting API.
Other related threads:
Comment #2
Lukas von BlarerWhat I need is a view field for the votes count in a search_api view. What is needed to accomplish this? I would give it a try if someone could point me in the right direction.
Comment #3
Lukas von BlarerI created a first patch that exposes the total votes count. It can easily be extended to expose more entity properties.
Comment #4
AlexSandberg CreditAttribution: AlexSandberg commentedThe patch works excellent. Thanks A Lot!
Comment #5
torgosPizzaThe patch in #3 works extremely well for me too!
For some reason (not sure if this is due to a recent module update or what), whenever I add the "Average rating" field to Search API's list of Fields to index, I end up with a fatal memory exhaustion error, and the indexing fails.
However with the addition of this property_info_alter() I'm able to index the average value for all nodes and then use this as a value in Search API Sorts, and can successfully sort based on average. Odd, but it works. I've attached my patch here in case anyone wants to look at it, but #3 is RTBC in my opinion.
Comment #6
JimSmith CreditAttribution: JimSmith commentedThe patches in #3 and #5 work as advertised. Much appreciated!
Comment #7
kyletaylored CreditAttribution: kyletaylored commentedI went ahead and made a combined patch from #3 and #5, just to make application a little easier.
Comment #8
torotil CreditAttribution: torotil commentedVoting api has switched to supporting entities in general not just nodes. This could would work fine for nodes but doesn't for all other entity-types. I would really like to generalize it before it goes into votingapi - and not introduce another node-only feature.
Comment #9
torotil CreditAttribution: torotil commentedComment #10
torotil CreditAttribution: torotil commentedComment #11
kopeboy CreditAttribution: kopeboy commentedWhat's the state of this?
Comment #12
torotil CreditAttribution: torotil commentedThere is a patch that needs generalization from nodes to entities before it can go into votingapi.
Comment #13
Christopher Riley CreditAttribution: Christopher Riley commentedAny update on this?
Comment #14
torotil CreditAttribution: torotil commentedAs far as I can see: no. I'm still waiting for an entity-based patch for this (see #8). That's the reason why this is set to "needs work".
Sadly so far no one has been sufficiently interested in this feature to provide one.
Comment #15
Christopher Riley CreditAttribution: Christopher Riley commentedThanks for the information. I have a project that I am working on that this functionality would be very useful however I am stuck on a few things. One the above patch limits us to only one vote per node and also the bigger dilemma is what module should have the responsibility for notifying the search api to reindex a item. For example in my instance I am using fivestar for people to rate a product in a comment that is attached to a drupal commerce product display. The comment then adds the rating to the parent node. Should the responsibility fall to the fivestar module to do the reindex command or should it be done on the votingapi end so that there are a larger potential needs filled.
Opions and or feedback?
Comment #16
torotil CreditAttribution: torotil commentedSome thoughts on that:
Comment #17
Christopher Riley CreditAttribution: Christopher Riley commentedAlright one last question before I start trying to wrap my head around the best way to get this done quickly so that I can get the site I am working on launched. Do you think that it should be an additional module or an addition to the core module?
Comment #18
torotil CreditAttribution: torotil commentedI would try to do it as a submodule (votingapi_search?), because it forces us to separate the code clearly and it avoids additional dependencies. Maybe we can integrate the code in the core module as soft-dependency later on.
Comment #19
Christopher Riley CreditAttribution: Christopher Riley commentedAlright thanks for the feedback now if I can just make some time to see about getting something implemented quickly. I will keep everyone updated.
Comment #20
k.dani CreditAttribution: k.dani commentedI've managed to create a sandbox project for the integration: https://www.drupal.org/sandbox/k.dani/2431227
I'm not sure that my solution is better than the provided patch, but give it a try and feel free to add some feedback.
If it is usable, i'll promote it to full project.
Comment #21
nareshbw CreditAttribution: nareshbw commentedI am using Apache solr search . But I am unable to use voting api functionality on search page items.
Comment #22
Bohus UlrychHi torotil,
I understand your point #8 but it seems that everyone is interested in integration with Nodes and not with other entities. After my unsuccessful attempts to find how to do it I found this discussion but it took me few hours. And I suppose that I'm not the only one.
What about to implement patch #7 to the dev version, or at least to put in the README.TXT reference to this thread with subject e.g. "partly Search API integration"?
Thanks
Comment #23
abrammI've faced the same issue and made a sandbox project for Entity API integration:
https://www.drupal.org/sandbox/abramm/2748623
The process somewhat reverse to what patches above does; the idea is to expose votes as entities so the votes may be indexed.