AddResultSymbols() public method

public AddResultSymbols ( List matches ) : void
matches List
return void
Esempio n. 1
0
        private void FindSymbols(Query query, Interpretation interpretation)
        {
            string searchTerm = interpretation.CoreSearchTerm;

            var search = new SortedSearch(i => symbols[i].Name, symbols.Count);

            int low, high;

            search.FindBounds(searchTerm, out low, out high);

            if (high < low)
            {
                return;
            }

            query.PotentialRawResults = high - low + 1;

            var result = Enumerable
                         .Range(low, high - low + 1)
                         .Where(i => !interpretation.IsVerbatim || symbols[i].Name.Length == searchTerm.Length)
                         .Select(i => symbols[i].GetDeclaredSymbolInfo(huffman, assemblies, projects))
                         .Where(query.Filter)
                         .Where(interpretation.Filter)
                         .Take(MaxRawResults)
                         .ToList();

            foreach (var entry in result)
            {
                entry.MatchLevel = MatchLevel(entry.Name, searchTerm);
            }

            query.AddResultSymbols(result);
        }
Esempio n. 2
0
        private void FindSymbols(Query query, Interpretation interpretation)
        {
            string searchTerm = interpretation.CoreSearchTerm;

            List <DeclaredSymbolInfo> result = new List <DeclaredSymbolInfo>();

            bool wildCardsUsed = false;

            if (searchTerm.Contains('?') || searchTerm.Contains('*'))
            {
                wildCardsUsed = true;
                searchTerm    = WildCardToRegular(searchTerm);
            }

            if (wildCardsUsed)
            {
                Regex searchRegex = new Regex(searchTerm, RegexOptions.IgnoreCase | RegexOptions.Compiled);

                result = symbols.Where(_ => searchRegex.IsMatch(_.Name))
                         .Select(_ => _.GetDeclaredSymbolInfo(huffman, assemblies, projects))
                         .Where(query.Filter)
                         .Where(interpretation.Filter)
                         .Take(MaxRawResults)
                         .ToList();
            }
            else
            {
                var search = new SortedSearch(i => symbols[i].Name, symbols.Count);

                int low, high;
                search.FindBounds(searchTerm, out low, out high);

                if (high < low)
                {
                    return;
                }

                query.PotentialRawResults = high - low + 1;

                result = Enumerable
                         .Range(low, high - low + 1)
                         .Where(i => !interpretation.IsVerbatim || symbols[i].Name.Length == searchTerm.Length)
                         .Select(i => symbols[i].GetDeclaredSymbolInfo(huffman, assemblies, projects))
                         .Where(query.Filter)
                         .Where(interpretation.Filter)
                         .Take(MaxRawResults)
                         .ToList();
            }

            foreach (var entry in result)
            {
                entry.MatchLevel = MatchLevel(entry.Name, searchTerm);
            }

            query.AddResultSymbols(result);
        }
Esempio n. 3
0
        private void FindSymbols(Query query, Interpretation interpretation)
        {
            string searchTerm = interpretation.CoreSearchTerm;

            var search = new SortedSearch(i => symbols[i].Name, symbols.Count);

            int low, high;
            search.FindBounds(searchTerm, out low, out high);

            if (high < low)
            {
                return;
            }

            query.PotentialRawResults = high - low + 1;

            var result = Enumerable
                .Range(low, high - low + 1)
                .Where(i => !interpretation.IsVerbatim || symbols[i].Name.Length == searchTerm.Length)
                .Select(i => symbols[i].GetDeclaredSymbolInfo(huffman, assemblies, projects))
                .Where(query.Filter)
                .Where(interpretation.Filter)
                .Take(MaxRawResults)
                .ToList();

            foreach (var entry in result)
            {
                entry.MatchLevel = MatchLevel(entry.Name, searchTerm);
            }

            query.AddResultSymbols(result);
        }