예제 #1
0
        private Tuple <TimeSpan, string[], int> FindItems(string prefix)
        {
            var sw              = Stopwatch.StartNew();
            var foundItems      = AutocompleteTask.GetTopByPrefix(phrases, prefix, 10);
            var foundItemsCount = AutocompleteTask.GetCountByPrefix(phrases, prefix);

            if (foundItems == null)
            {
                var oneItem = AutocompleteTask.FindFirstByPrefix(phrases, prefix);
                foundItems = oneItem != null ? new[] { oneItem } : new string[0];
            }
            return(Tuple.Create(sw.Elapsed, foundItems, foundItemsCount));
        }