Esempio n. 1
0
        private void UpdateAutoCompleteSuggestions(string searchTerm)
        {
            using (AutoCompletionSuggestions.EnterMassUpdate())
            {
                AutoCompletionSuggestions.Clear();
                searchTerm = searchTerm?.Trim();
                if (string.IsNullOrEmpty(searchTerm))
                {
                    return;
                }

                var newSuggestions = _tagIndex
                                     .GetRecommendations(Tags.Select(t => t.Text), searchTerm)
                                     .Select(result => new SuggestionModel(result.SearchTag, SuggestionChosen))
                                     .Take(10);

                AutoCompletionSuggestions.AddRange(newSuggestions);
            }
        }