I'm soon going to need to rewrite/enhance a search engine for a site. What I need it to do is give results priority based on the number of times they were successfully searched for. In other words, if 50 people go searching for "Canned Pork," 30 of them look at the results and click on "Ye Olde Canned Pork," 10 of them click on "Canned Pork MX-7", and the rest click on an assortment of other results, the engine needs to know to provide "Ye Olde Canned Pork" as the first search result every time. Of course I mean this should be dynamic and automatic, so that if MX-7 Canned Pork starts to become more popular as a result, the search engine makes that the #1 result. This is similar to what Google does.
I have no idea how to do it, really. Obviously, there's a table that's tracking searches somewhere, but how do I track the results that people pick first when they do a search, and then match it to what they searched for, and then use that data to influence future search results?
building a better search
Moderator: General Moderators
make a new field on the table where the products are, name it hits. When the user searches for something and the results come up, order them by hits, when the user clicks to get more info send him to a site that will update the hits for that item. Then redirect to the info on that product. Not to hard...
add a table
create table result_prefs(
terms text NOT NULL,
website tinytext NOT NULL,
hits int NOT NULL default '0',
FULLTEXT terms ( terms )
) TYPE=MyISAM;
if the new terms are a subset of previous terms, add all the hits for that site together to use the ranking
that gives you weight based on what others with SIMILAR searches go for. if you can also make the comob of the terms/website unique then i'd do that. i've never tried so i'm not sure.
then you can search for where the terms and website are equal and add one to the hits when someone clicks the link
create table result_prefs(
terms text NOT NULL,
website tinytext NOT NULL,
hits int NOT NULL default '0',
FULLTEXT terms ( terms )
) TYPE=MyISAM;
if the new terms are a subset of previous terms, add all the hits for that site together to use the ranking
that gives you weight based on what others with SIMILAR searches go for. if you can also make the comob of the terms/website unique then i'd do that. i've never tried so i'm not sure.
then you can search for where the terms and website are equal and add one to the hits when someone clicks the link