コード例 #1
0
        public static Dictionary <string, int> GetInitialLetters()
        {
            Dictionary <string, int> oResult = null;
            GenSearchService         oSearchService;
            Query oQuery;

            oQuery         = new WildcardQuery(new Term(Genworth.SitecoreExt.Constants.HelpCenter.Indexes.GlossaryIndex.Fields.Prefix, Genworth.SitecoreExt.Constants.HelpCenter.QueryParameters.SearchAllValue));
            oSearchService = new GenSearchService();

            try
            {
                oResult = oSearchService.ExecuteGroupCountQuery(oQuery, Genworth.SitecoreExt.Constants.HelpCenter.Indexes.GlossaryIndex.Name, Genworth.SitecoreExt.Constants.HelpCenter.Indexes.GlossaryIndex.Fields.Prefix);
            }
            catch (Exception oSearchException)
            {
                Sitecore.Diagnostics.Log.Error("Error executing search request", oSearchException, typeof(EventHelper));
            }
            finally
            {
                oSearchService = null;
            }

            return(oResult.ToDictionary(oKeypair => oKeypair.Key.Replace(Genworth.SitecoreExt.Constants.HelpCenter.Indexes.GlossaryIndex.StartsWith, ""), oPair => oPair.Value));
        }