grahamjenson / ger

Good Enough Recommendation (GER) Engine
376 stars 47 forks source link

easy way to find_events that aren't expired? #47

Open joshbedo opened 8 years ago

joshbedo commented 8 years ago

I was looking through the find_events method to check out how it handles expiries and their wasn't an obvious way to pull in all events that haven't expired. Does this exist? something i overlooked?

grahamjenson commented 8 years ago

The find_events method should not return expired events, and in the options object you can pass size and page to scroll through the events. Also you can pass a current_datetime object or string that can 'lock' a query to a specific time, so that inserting new data doesnt screw with your paging.

One of my initial assumptions was that there would be millions of events that haven't expired, so I didnt really see the need to pull all unexpired events. What do you need the functionality for?

joshbedo commented 8 years ago

Awesome that helps, i was thinking I needed to configure something for expiries. I have a getRecommendations method that does the following but I thought i needed to configure it to pull in the non-expired events. Thanks!

  1. find previous non-expired events for the current user id
  2. do events.map((ev) => ev.thing) to get the user ids
  3. Search for users in elasticsearch based on user preferences and exclude users with the previous list of ids

Definitely going to check out the pagination, I'll probably need that later on.