public CrawledIssueResults Search(string searchText) { if (_indexService.Index is null) { return(CrawledIssueResults.Empty); } var isOpenIssuesQuery = searchText == "is:open is:issue"; if (isOpenIssuesQuery && _openIssuesResults != null) { return(_openIssuesResults); } var stopwatch = Stopwatch.StartNew(); var query = IssueQuery.Create(searchText); var results = query.Execute(_indexService.Index); var elapsed = stopwatch.Elapsed; Task.Run(() => _telemetryClient.GetMetric("Search") .TrackValue(elapsed.TotalMilliseconds) ); if (isOpenIssuesQuery && _openIssuesResults is null) { _openIssuesResults = results; } return(results); }
private void IndexService_Changed(object sender, EventArgs e) { _openIssuesResults = null; }