void ISearchManager.SubmitSearch(SearchAllOptions options) { var positiveFilters = options.Filters.GetPositiveFilters(); if (positiveFilters.Count == 0) { return; } var searchWorkers = sources.Items.GetScopeSources(positiveFilters).Select(s => factory.CreateSearchWorker(s, options)).ToList(); var newSearchResults = positiveFilters.Select(filter => factory.CreateSearchResults(this, options, filter, ++lastId, searchWorkers)).ToList(); var currentTop = GetTopSearch(); results.ForEach(r => r.Cancel()); // cancel all active searches, canceling of finished searches has no effect RemoveSameOlderSearches(newSearchResults); results = results.AddRange(newSearchResults); EnforceSearchesListLengthLimit(lastId - newSearchResults.Count + 1); if (currentTop != null && !currentTop.Pinned) { currentTop.Visible = false; } searchWorkers.ForEach(w => w.Start()); SearchResultsChanged?.Invoke(this, EventArgs.Empty); changeNotification.Post(); }
internal SearchWorker( ILogSource logSource, SearchAllOptions options, Telemetry.ITelemetryCollector telemetryCollector ) { this.logSource = logSource; this.options = options; this.worker = Worker(); this.telemetryCollector = telemetryCollector; }
public SearchResult( ISearchManagerInternal owner, SearchAllOptions options, IFilter optionsFilter, IList <ILogSourceSearchWorkerInternal> workers, Progress.IProgressAggregatorFactory progressAggregatorFactory, ISynchronizationContext modelSynchronization, Settings.IGlobalSettingsAccessor settings, int id, ISearchObjectsFactory factory, ITraceSourceFactory traceSourceFactory ) { this.owner = owner; this.options = options; this.optionsFilter = optionsFilter; this.factory = factory; this.modelSynchronization = modelSynchronization; this.id = id; this.cancellation = new CancellationTokenSource(); this.results = new List <ISourceSearchResultInternal>(); this.progressAggregator = progressAggregatorFactory.CreateProgressAggregator(); this.updateInvokationHelper = new AsyncInvokeHelper(modelSynchronization, UpdateStatus); this.hitsLimit = settings.MaxNumberOfHitsInSearchResultsView; this.visible = true; this.trace = traceSourceFactory.CreateTraceSource("SearchManager", "sr." + id.ToString()); this.timeGapsDetector = new TimeGapsDetector(trace, modelSynchronization, this, traceSourceFactory); this.timeGapsDetector.OnTimeGapsChanged += (s, e) => { owner.OnResultChanged(this, SearchResultChangeFlag.TimeGapsChanged); }; this.progressAggregator.ProgressChanged += HandleProgressChanged; this.searchTime = Stopwatch.StartNew(); this.results.AddRange(workers.Select(w => factory.CreateSourceSearchResults(w, this, cancellation.Token, progressAggregator))); if (results.Count == 0) { status = SearchResultStatus.Finished; HandleFinalStateTransition(); } }
ILogSourceSearchWorkerInternal ISearchObjectsFactory.CreateSearchWorker(ILogSource forSource, SearchAllOptions options) { return(new SearchWorker(forSource, options, telemetryCollector)); }
ISearchResultInternal ISearchObjectsFactory.CreateSearchResults( ISearchManagerInternal owner, SearchAllOptions options, IFilter optionsFilter, int id, IList <ILogSourceSearchWorkerInternal> workers) { return(new SearchResult(owner, options, optionsFilter, workers, progressAggregatorFactory, modelSynchronization, settings, id, this, traceSourceFactory)); }