Question

I have a list of products in which user can like and dislike the product. Like,dislike and number views count is stored in redis.

Now, i want to fetch trending products based on view/likes and dislikes.Is there any gem or algorthim .

Edit

The data stored as product: product_id: followers = [user.id] i.e product:4:followers = ["1", "3"]

Était-ce utile?

La solution

This article gives a proper solution. http://sorentwo.com/2013/12/30/let-postgres-do-the-work.html

Autres conseils

There are multiple voting / recommendation engines for Rails, some common one are:

https://github.com/ryanto/acts_as_votable

https://github.com/davidcelis/recommendable

Also try this page, Ruby Toolbox is good at searching for various gems. You will see the first two on the list support Redis.

https://www.ruby-toolbox.com/categories/Recommendation_Engines

Since the data is stored in Redis, you can use ZRANK function of Redis.

Gem - https://github.com/redis/redis-rb

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top