Пример #1
0
        public List <Result> Query(Query query)
        {
            foreach (var programArgumentParser in _programArgumentParsers)
            {
                if (!programArgumentParser.Enabled)
                {
                    continue;
                }

                if (!programArgumentParser.TryParse(query, out var program, out var programArguments))
                {
                    continue;
                }

                var results1 = _win32ProgramRepository.AsParallel()
                               .Where(p => p.Enabled)
                               .Select(p => p.Result(program, programArguments, _context.API));

                var results2 = _packageRepository.AsParallel()
                               .Where(p => p.Enabled)
                               .Select(p => p.Result(program, programArguments, _context.API));

                var result = results1.Concat(results2).Where(r => r != null && r.Score > 0);
                if (result.Any())
                {
                    var maxScore = result.Max(x => x.Score);
                    result = result.Where(x => x.Score > Settings.MinScoreThreshold * maxScore);
                }

                return(result.ToList());
            }

            return(new List <Result>(0));
        }
Пример #2
0
        public List <Result> Query(Query query)
        {
            var results1 = _win32ProgramRepository.AsParallel()
                           .Where(p => p.Enabled)
                           .Select(p => p.Result(query.Search, _context.API));

            var results2 = _packageRepository.AsParallel()
                           .Where(p => p.Enabled)
                           .Select(p => p.Result(query.Search, _context.API));

            var result = results1.Concat(results2).Where(r => r != null && r.Score > 0).ToList();

            return(result);
        }
Пример #3
0
        public List <Result> Query(Query query)
        {
            var results1 = _win32ProgramRepository.AsParallel()
                           .Where(p => p.Enabled)
                           .Select(p => p.Result(query.Search, _context.API));

            var results2 = _packageRepository.AsParallel()
                           .Where(p => p.Enabled)
                           .Select(p => p.Result(query.Search, _context.API));

            var result   = results1.Concat(results2).Where(r => r != null && r.Score > 0);
            var maxScore = result.Max(x => x.Score);

            result = result.Where(x => x.Score > Settings.MinScoreThreshold * maxScore);

            return(result.ToList());
        }