Dibatalkan

Javascript relevance check using Prototype

I need to compare a list of tags associated to a particular product against a list of other products with tags, to find related products. I need to return the products that have at least 4 or more matching tags sorted by products with the tag most matches first. All the solutions I have seen are slow and overly complex. Here's the idea of what I'm looking for:

//current product tags

var tags = ['apple','glows in the dark', 'green', 'Halloween', 'holiday', 'solid color'];

//list of possibly related products

var list = [

//example of fairly related product

{id:456,tags:'apple','black,'boxed set','glows in the dark', 'green','Halloween','holiday','orange','purple','solid color','spiced apple cider','swirl color'},

//example of unrelated product

{id:789,tags:'boxed set','cotton candy','oatmeal cookie', 'pink','solid color','wedding cake','white','yellow'}

//... more products...

];

getRelated(tags, list);

I have seen lots of examples of code that compares 2 strings for differences, but these are doing a character by character comparison and I simply need a tag by tag check. Somethings that should help you optimize this script is that all tags will be in alphabetical order (binary search?). Also these will be relatively small data sets I'd say you'd be checking 7 - 15 tags on 30 products against the current list of tags. Upon payment of the fee I will have full ownership, including copyright, to the content submitted. To prove you have read this posting and agree to the terms please include the phrase Hi Daniel somewhere in your bid. The solution will have access to the Prototype JavaScript framework, version 1.6.0.1 so please make use of those extensions (pluck, inject etc) as needed.

Please let me know if you have any questions... good luck!

Kemahiran: Javascript

Lihat lebih lanjut: javascript relevance, yellow character, what is binary search with example, what is binary search in c, what is binary search, what is a binary search, use of binary, sorted data set, search binary, prototype idea, prototype help, please let me know if you have any questions, order of binary search, matching strings, matches list, make prototype product, make prototype, make me yellow, make a prototype of a product, list matches, list binary search, idea to prototype, hi in binary code, find javascript, find binary

Tentang Majikan:
( 5 ulasan ) Beaverton, United States

ID Projek: #339376