qlands / elasticfeeds

A Python library for managing feeds using ElasticSearch
Other
19 stars 4 forks source link

how to make this relevant to separate users. #1

Closed johndpope closed 1 year ago

johndpope commented 1 year ago

I have a pool of users - some of which I don't care about - I want to add friends - request / reply - accept friendship - then only see a subset of this. I built on top of this many years ago - but code seems bin job. https://github.com/ging/social_stream

BioversityCostaRica commented 1 year ago

Hi @johndpope

To exclude some users that you don't care about you can link them to a criterion of exclusion. For example:

my_actor = Actor('mark', 'person') exclusion_list = Object('excluded_persons', 'exclusion_list') exclusion_activity = Activity('excluded', my_actor, exclusion_list) my_manager.add_activity_feed(exclusion_activity)

But then you need to write your own aggregators that exclude persons that are part of the exclusion list.

Everything is managed by ES queries. Feeds are basically connections between entities so you can write queries to satisfy your needs. Have a look at the "unaggregated" aggregator so you can write a "Relevant" aggregator to separate users.

johndpope commented 1 year ago

imagine the pool is hundreds of millions of users - like telegram. exclusion not going to scale. I just want to have feeds from a small circle of my friends (that I've approved) exactly like facebook. I had this working before in the above ruby on rails project. I might have to persevere with that one. thanks for your help.

If there was in interest to update the model - and re-implement in python

qlands commented 1 year ago

Well, with ES you can scale it to anything since is “fan-out on read”. If you follow a number of friends you can just say that "A" follows/is_friends_with "B". After a while, "A" will have 10,0000 friends so in a “fan-out on read” with ES you can write an aggregator to satisfy your needs and have scalable notifications in seconds.