Answer the question
In order to leave comments, you need to log in
How to make "hot/interesting" posts?
The second day I think about how the interesting news algorithm should work. It is clear that a selection of all posts is made by some cron and then it is ranked. The problem comes a little further.
For example, after the next ranking, the following list was obtained:
1, 2, 3, 4, 5, 6, 7, 8, 9
These records are issued to the user 4 pieces per page.
The user opens the page and sees:
1, 2, 3, 4
Next, the cron job runs and redistributes the pages. That is, after the current ranking, the following list is obtained:
1, 5, 6, 4, 3, 2, 7, 8, 9
And when the user goes to the second page, the server will give him the records that he has already seen:
3, 2, 7, eight
What is the correct way to implement such dynamic feeds?
Answer the question
In order to leave comments, you need to log in
Make a link to the second page something like '?list=ID&page=2'
Where ID is the id of the last list.
For example, they forget about this on Habré ...
UPD: in order not to clog the address bar and search engines, you can store this ID in a cookie
You can remove the pagination and just do that first 5 pieces are displayed, then when you scroll the wheel to the end of the page, the following ones are displayed (without reloading the page), in the image of how the news is made in VK.
Correctly, such tapes are built depending on the approach.
1. When the ranking is global. In this case, each record has a certain rank - a calculated field that is recalculated on an event. For example, when someone makes a comment on it or every seventh view. The rank calculation logic depends on the resource and content. Well and further elementary sorting. If you wish, you can exclude viewed articles.
2. When ranking depends on user preferences. In this case, when the user is authorized in the background process, the rank is calculated or the feed is built on the fly. To build a tape on the fly, a combination of graph and conventional bases is used. Graphists can quickly calculate the degree of influence of preferences and user relationships among themselves.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question