With the "hotest" images uploaded, I want to populate the homepage of the submitted-site site by my user.
- How many people have taken care of this illustration
-
Vote
date has been voted in the table
-
- Ul>
-
Comments
is the date of comment in the table
I searched around , But user authorization should not play a part, but most algorithms are included in it
I should also know whether it is better to calculate my SQL data or if there is a PHP / cron method every hour.
I only need 20 pictures to populate the home page. I do not need any kind of paging for this data.
How do I age against votes? Surely, the date of the deposit of the deposit site is less weight?
Many sites that use some type of popularity rank ranking using a standard algorithm Doing so and doing it all the time with constant tolerance. What I've found works better for sites with less traffic, a multiplier that gives bonuses on new content / activity - it's essentially the same, but stops the score after the time of your selection.
For example, here is a proxy example that you can try. Of course, adjust the amount of weight you want for each category based on your own experience with your site. Would like to do. Remarks are rare, but rather than a favorite / vote, the user takes more effort, so he should probably gain more weight.
score = (votes / 10) + comments age = UNIX_TIMESTAMP () - UNIX_TIMESTAMP (date_created) if (age = Lt; 86400) score = score * 1.5
This type of approach will give bonus on new content uploaded on the previous day. If you want to contact this kind of content like this in a way that has been recently liked or commented, then you can simply add some obstacles on your query that extract scores from the DB.
Actually two big reasons not to calculate this ranking on the fly.
- To get all the data, your DB is required and calculates on each page load to reorder item results in just a query.
- There is probably a small hold, but if you have a relatively small activity on the site, then small changes in the ranking can cause the material to move very fast.
This leaves you either caching results from time to time, or maintains a ranking that updates you to a new database column to update a new database column. are doing.
Comments
Post a Comment