Jump to content

Archived

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

jwwceo

Similar Item Search - percentage match

Recommended Posts

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...

Share this post


Link to post
Share on other sites
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% match
5 search words put in,  2 search words returned in the recordset row 2 2/5 = 40% match

iterate over the recordset percentages and then order them highest first

so 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%

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

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.