Jump to content

tags - most popular searched terms


MDanz

Recommended Posts

Every time somebody searches, you add that to a database table, perhaps with other info like the IP address. If you want to know what the most popular database searches are, you query the database to return the column, use some function like trim() on each row, also converting all chars to lowercase, and then you'll use a simple function to count all occurrences of each search term or phrase. Put each term or phrase in an array with it's count, and then sort the array by count. Pick off the top 5, 10, or whatever. This might be a lot of work.... so you might cache this and only run it once every half hour or something. Also, since you have a top 5 or 10, you might consider deleting rows that don't seem to have a chance to compete, if you know what I mean. You could probably tweak this to perfection, or with minimal work at least get something usable.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.