: 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
if 5 is a hard max on the number of colors that you support, then you can always use 5 seperate fields to store the colors in order of "dominance" and then query on those 5 fields with varying boosts... color_1:black^10 color_2:black^7 color_3:black^4 color_4:black color_5:black^0.1 ...something like this will loose the % granularity info that you have (so a 60% black skirt and an 80% black dress would both score the same against black since it's hte dominant color) alternately: i'm assuming your percentage data only has so much confidence -- maybe on the order of 10%?. you can have a seperate field for each "bucket" of color percentages and index the name of hte color in the corrisponding bucket. with 10% granularity that's only 10 fields -- a 10 clause boolean query for the color is no big deal ... even going to 5% would be trivial. Incidently: people interested in teh general topic of color faceting at a finer granularity then just color names may want to check out this thread from last... http://www.nabble.com/faceting-and-categorizing-on-color--tf1801106.html -Hoss