Hi Renaud, I think your method will produce strange results, probably in most cases, e.g.
33% red #FF0000 = #550000 33% green #00FF00 = #005500 33% blue #0000FF = #000055 = #555555 Thus, red, green and blue dress would score well against a search for "medium gray". Not good. Steve Renaud Waldura wrote: > Here's another idea: encode color mixes as one RGB value (32 bits) and sort > according to those values. To find the closest color is like finding the > closest points in the color space. It would be like a distance search. > > 70% black #000000 = 0 > 20% gray #f0f0f0 = #303030 > 10% brown #8b4513 = #0e0702 > = #3e3732 > > The distance would be: > sqrt( (r1 - r0)^2 + (g1 - g0)^2 + (b1 - b0)^2 ) > > Where r0g0b0 is the color the user asked for, and r1g1b1 is the composite > color of the item, calculated above. > > --Renaud > > > -----Original Message----- > From: Steven Rowe [mailto:[EMAIL PROTECTED] > Sent: Friday, September 28, 2007 7:14 AM > To: solr-user@lucene.apache.org > Subject: Re: Color search > > Hi Guangwei, > > When you index your products, you could have a single color field, and > include duplicates of each color component proportional to its weight. > > For example, if you decide to use 10% increments, for your black dress with > 70% of black, 20% of gray, 10% of brown, you would index the following terms > for the color field: > > black black black black black black black > gray gray > brown > > This works because Lucene natively interprets document term frequencies as > weights. > > Steve > > Guangwei Yuan wrote: >> Hi, >> >> We're running an e-commerce site that provides product search. We've >> been able to extract colors from product images, and we think it'd be >> cool and useful to search products by color. A product image can have >> up to 5 colors (from a color space of about 100 colors), so we can >> implement it easily with Solr's facet search (thanks all who've developed > Solr). >> The problem arises when we try to sort the results by the color relevancy. >> What's different from a normal facet search is that colors are >> weighted. For example, a black dress can have 70% of black, 20% of >> gray, 10% of brown. A search query "color:black" should return results >> in which the black dress ranks higher than other products with less > percentage of black. >> My question is: how to configure and index the color field so that >> products with higher percentage of color X ranks higher for query > "color:X"? >> Thanks for your help! >> >> - Guangwei > >