Example: tinder profile recommendations based on location, google map recommendations etc. I am more interested in knowing about the systems where the entities' location keep on changing. For an example tinder profiles. Some lines from my stack overflow question: How does tinder and other applications show the near by active users, events and places? I am mainly interested in knowing how the data is modelled in DB and how is real time locations processed for the entities to make them available for faster search. I know this is more of a stack overflow question but the question was closed as it is opinion based.
Recommendations are based on many factors which are static like interests, features, age etc. On top of that dynamic factors like location act as the last filter, so it's less precomputed but more dynamic filtering. Now the problem is filtering by dynamically changing location. Divide the area in user's radius in terms of grid. Arrange grid as an n-ary tree divided by coordinates of smaller grid. Return user's with last location in the grid same as user & nearby grids. Update last location data in saved in cache followed by saving in db. You'll get fast grid lookups due to tree and fast location filtering on looked up data.
Interesting question! I'm just going to put my thoughts here, I can be totally wrong. Never worked with such a system. 1. Precompute/Batch compute recommendations based on top locations (cities) and user profile using static data. Assumption: Most of your users are in urban cities. 2. Store recommendations as: UserN: { Location A: [user1, user2,...], Location B: [....] } Consider: 1 & 2 would be from getMatchesService. And they can have recommendation updating job run based on how frequently the data changes. 3. Based on current location, pick the closest location and get users list. Have another filteringService which removed already shown users through some sort of bloom filter implementation. 4. On client side, after getting the matched users list, filter based on user and matched user location as the person swipes? What I'm not sure of: 1. Cost of filtering at client side 2. Cost of recalculating recommendations 3. To generate precomputed results, we may not need super accurate results. They can be at a let's say 15 block radius. Some generic geospacial indexing format has to be used here.
Valid points. Concept of geospatial indexing looks interesting as the backend service might divide the map into some chunks and then provide the results from the neighboring chunks.
Thanks! This was just some thoughts what came to my mind.