58 Following

Michelle's corner

Michelle Knight. Writer, photographer, programmer, truck driver and general, all round nut case. Life is a journey and that's what this blog will probably end up being. Let's see where we go, eh? ;-)

Currently reading

Your Beauty Mark. All You Need to Get the Hair, Makeup, Glow, and Glam.
Dita von Teese
Progress: 208/256 pages

User engagement - Part Deux

(Apologies, "Hot Shots"!)

Windows are easy. Once they're programmed, they go off and make automatic queries of the database...

select * from database where body %like% "Shhh, don't tell anyone this, but..."

...and then presents it to the user in a straightforward display wrapper.

Mind you, sometimes it isn't as straightforward as that. Database queries can be a dark art. Get it wrong and the engine will come out from the CPU waving the white flag of surrender, while the hard drives quietly smoke in the back of the server.

The trick is to find the nuggets that the automatic queries will miss, without putting a strain on the system or the administrators. The admin element is all well and good in the beginning, but as the platform grows then things will start to slip.

A, "weight," can be assigned to each post. Something simple, like starting at 10, subtracting the age of the post and adding the number of likes.

update database set weight = 10-age+likes;

...then simply select posts that have the strongest weight. So as a post ages, its weight drops, and even a post with 1 like today, will score higher than a three day old post that got two likes.

Obviously, an update like this needs to be done once a day, and restricted to posts of a certain age otherwise it could potentially take an unacceptable time to execute against an ever-growing database.

But it's a start. Otherwise, the popular stay at the top and no one else will ever get a look-in.