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