Jump to content

Similar Item Search - percentage match


jwwceo

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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