예제 #1
0
        public FacetTranslator(IGlassInterfaceFactory factory, I_Refinement_Configuration config, IDictionary <string, string> selectedFacets)
        {
            RefinementLookup = new Dictionary <string, Tuple <ISearchRefinement, string[]> >();

            var availableRefinements = new List <I_Refinement>();

            if (config != null)
            {
                if (config.Refinements_To_Displays != null)
                {
                    availableRefinements.AddRange(config.Refinements_To_Displays);
                }

                if (config.Hidden_Available_Refinements != null)
                {
                    availableRefinements.AddRange(config.Hidden_Available_Refinements);
                }
            }

            IEnumerable <ISearchRefinement> refinements = factory.GetItems <ISearchRefinement>(availableRefinements);

            if (refinements != null)
            {
                foreach (ISearchRefinement refinement in refinements)
                {
                    RefinementLookup[refinement.FieldName] = new Tuple <ISearchRefinement, string[]>(refinement, selectedFacets.ContainsKey(refinement.RefinementKey) ? selectedFacets[refinement.RefinementKey].Split(';') : null);
                }
            }
        }
예제 #2
0
 public IEnumerable <ISearchRefinement> GetRefinements()
 {
     return(_factory.GetItems <ISearchRefinement>(_parser.RefinementOptions));
 }