예제 #1
0
        SpellCheckCollation[] IMemberSearchService.GetSpellingSuggestions(string queryString, int maxCollations)
        {
            const string method = "GetSpellingSuggestions";

            try
            {
                #region Log
                Stopwatch executionTime = null;
                if (EventSource.IsEnabled(Event.Trace))
                {
                    executionTime = Stopwatch.StartNew();
                }
                #endregion

                var collations = _spellCheckHandler.GetSpellingSuggestions(queryString, GetReader(), _maxSpellings, maxCollations, true);

                #region Log
                if (executionTime != null)
                {
                    executionTime.Stop();
                    EventSource.Raise(Event.Trace, method, "Execution complete.",
                                      Event.Arg("queryString", queryString),
                                      Event.Arg("suggestion count", collations.Count),
                                      Event.Arg("executionTime", executionTime.ElapsedMilliseconds));
                }
                #endregion

                return(collations.ToArray());
            }
            catch (Exception e)
            {
                #region Log
                EventSource.Raise(Event.Error, method, "Unexpected exception.", e);
                #endregion
                throw;
            }
        }