Stream-Framework icon indicating copy to clipboard operation
Stream-Framework copied to clipboard

Filtering Feeds - not just by activity_id

Open affan2 opened this issue 11 years ago • 3 comments

Here's the scenario - User A follows User B B likes an news article B likes a company Both likes show up on A's feed

How can I filter A's feed to just show likes for just news articles or companies? So I have something like what Linkedin does where you can see 'all updates' or only show specific kinds.

The only solution i can think of presently is to create one feed for all actions, and individual feeds based on each of the filters I will have. Which would grow exponentially if I need to do the same for likes and comments on news articles, for example.

affan2 avatar Jun 03 '14 11:06 affan2

Hi, filtering on something else than activity_id is not a builtin feature in feedly; feed api have support but thats not enough to have filtering working out of the box. If you use cassandra as storage this is quite easy to add via secondary indexes; if you use redis you have to come up with an index implementation.

2014-06-03 13:01 GMT+02:00 Mohammed Affan [email protected]:

Here's the scenario - User A follows User B B likes an news article B likes a company Both likes show up on A's feed

How can I filter A's feed to just show likes for just news articles or companies? So I have something like what Linkedin does where you can see 'all updates' or only show specific kinds.

The only solution i can think of presently is to create one feed for all actions, and individual feeds based on each of the filters I will have. Which would grow exponentially if I need to do the same for likes and comments on news articles, for example.

— Reply to this email directly or view it on GitHub https://github.com/tschellenbach/Feedly/issues/62.

tbarbugli avatar Jun 03 '14 19:06 tbarbugli

I'm not planning on delving into Cassandra yet - so how would I go about an implementing an index? Pardon my ignorance but I'm pretty new to NoSQL and am largely winging it. Any docs I can look at? Thanks!

affan2 avatar Jun 03 '14 19:06 affan2

one way to do it is to have 1 sorted set per kind of filter you want to have; then you have to make sure that every time you add activities to feeds you also add a reference (activity_id) in the index; the same apply for deletes.

for example: say you want to filter on activities with object type news and activities with object type company. feed:index:42:company will contain the activity ids for feed 42 that have object type company.

Few random notes: Using sorted sets with activity id as score will give you the right sorting for free. Feedly has (not public apis) support already for retrieving activities from a bunch of activity ids (have a look at dehydrated activities and the hydrate cycle in the base feed for an actual usage). This sort of indexing comes with a cost in terms of extra networking and storage requirements.

And now a bit of self promotion: me and Thierry (the other main author of Feedly) release a beta version of Feedly as service. The idea is to expose similar features to Feedly via HTTP APIs and offer a fully managed activity feed system.

While it does not (yet) offer filtering on other fields than activity id, it would make it possible to push every activity to his own feed because you would not have to initialise feeds yourself but only target them.

eg.

feed('user-news:1').add_activity({..activity data about news..})

feed('user-companies:1').add_activity({.. activity data about company ..})

If you are interested in having a look you can see the client example here: https://github.com/tschellenbach/stream-python and the main website here: https://getstream.io

2014-06-03 21:39 GMT+02:00 Mohammed Affan [email protected]:

I'm not planning on delving into Cassandra yet - so how would I go about an implementing an index? Pardon my ignorance but I'm pretty new to NoSQL and am largely winging it. Any docs I can look at? Thanks!

— Reply to this email directly or view it on GitHub https://github.com/tschellenbach/Feedly/issues/62#issuecomment-45010549.

tbarbugli avatar Jun 03 '14 20:06 tbarbugli