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)); }
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); }
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()); }
public List <Result> Query(Query query) { Programs.Win32[] win32; lock (IndexLock) { // just take the reference inside the lock to eliminate query time issues. win32 = _win32s; } var results1 = win32.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); }