November Happy Hour will be moved to Thursday December 5th.

How do I add selected facets

Vote:
 

Hi

Im using solr3.5 in a commerce 7.5 environment. I'm trying to implement faceted search and I have come as far as managing to get facets with productcount for current search. I add the facets dynamically bu fetching the data in the corresponding metaclass field to always get up to date facets without having to change any config files.

Now I wan't to send the selected facets in to my search and I can't figure out how to do that. Seems like it should be a simple thing. The ActiveFilterFields and ActiveFilterValues are read only. I have tried to use criteria.Add() like below.

criteria.Add("itemwebcolor", new SimpleValue
            {
                key = "black||black",
                value = "black||black",
                locale = languageName,
                Descriptions = new Descriptions()
                {
                    defaultLocale = languageName,
                    Description = new Description[] 
                    { 
                        new Description 
                        { 
                            locale = languageName, 
                            Value = LocalizationService.Current.GetString(string.Format("/facets/{0}/{1}", "itemwebcolor", "black"))
                        } 
                    }
                }
            });

This works but only if I only add one SearchFilter with a single value. Should I want to add another facetgroup I get no results, even when there are products matching both values and I can't seem to add multiple facets for example red:blue:green.

There must be a better way to approach this since faceting is a very common feature in commerce sites. But how?

#91656
Oct 10, 2014 10:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.