jwwceo Posted September 5, 2006 Share Posted September 5, 2006 I have a website with a few hunded items, which could grow to a few thousand. One of the features I am trying to code is a button that will offer similar selections. All of my products are classified with keywords and colors. So when the search is run, it will check to see how many keywords and color matches there are and then returns recommendations, ideally with a percentage match, like say for example, a 93% match. I have seen these before and I really like the idea.Does anyone have any tips on the logic/ SQL query structure to do this... I can't wrap my head around the best way to do this... Quote Link to comment Share on other sites More sharing options...
paul2463 Posted September 5, 2006 Share Posted September 5, 2006 percentages are done from what you are searching for so if you search on "hard" "wooden" "curved" "smooth" and "yellow"run a count on the record sets for the amount of matches to the list put in 5 search words put in, 4 search words returned in the recordset row 1 4/5 = 80% match5 search words put in, 2 search words returned in the recordset row 2 2/5 = 40% matchiterate over the recordset percentages and then order them highest firstso if you had a "hard" "wooden" "curved" "smooth" and "yellow" in thye databse it would get 5 words in , 5 words out = 5/5=100% Quote Link to comment Share on other sites More sharing options...
paul2463 Posted September 5, 2006 Share Posted September 5, 2006 also you could use a thesaurus....any keyword that is put in, you could run it through and get all the synonyms for it and search on those to, any returns with synonyms gets a penalty on the maths for % mark Quote Link to comment Share on other sites More sharing options...
jwwceo Posted September 5, 2006 Author Share Posted September 5, 2006 I'm having trouble with the SQl statements... if I have 3 tables... one for items, one for keywords, and one for matching the two...how would I structure the SQL queries?How do I pass the info over to the results page, a big long GET? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.