private async Task DoUpdate(PodcastDocument document) { var json = JsonConvert.SerializeObject(document); var response = await _solrPodcasts.AddAsync(document); if (response.Status == 0) { await _solrPodcasts.CommitAsync(); _log.LogInformation($"Indexed podcast: {json}"); } else { var details = string.Join(";", response.Params.Select(x => x.Key + "=" + x.Value).ToArray()); _log.LogError($"Error indexing podcast: {json}. Response Status: {response.Status}. Details: {details}"); } }
public async Task <ResponseResult> Add() { // 同步添加文档 solr.Add( new PostDoc() { Id = 30001, Name = "This SolrNet Name", Title = "This SolrNet Title", Excerpt = "This SolrNet Excerpt", Content = "This SolrNet Content 30001", PostDate = DateTime.Now } ); // 异步添加文档 await solr.AddAsync( new PostDoc() { Id = 30002, Name = "This SolrNet Name", Title = "This SolrNet Title", Excerpt = "This SolrNet Excerpt", Content = "This SolrNet Content 30002", PostDate = DateTime.Now } ); ResponseHeader responseHeader = await solr.CommitAsync(); ResponseResult response = new ResponseResult(); if (responseHeader.Status == 0) { response.Status = ResponseStatus.SUCCEED; } return(response); }
public Result Handle(ApproveNewsCommand command) { //news should be picked from queue //approved and removed from the queue //db entry for the item //pushed to solr //send email to the queue var news = _provider.GetById(command.NewsId); news.Approved = true; _provider.Update(news); var solrNews = new SolrNewsItem() { Category = null, Details = news.Details, Id = news.Id, Source = news.Source.Name, Title = news.Title, Thumbnail = news.Images.FirstOrDefault()?.ImagePath }; _solrOperation.AddAsync(solrNews); return(Result.Ok()); }
public async Task AddAsync(CandidatoDocumento documento) { await _solr.AddAsync(documento); await _solr.CommitAsync(); }
public void AddToSolr(T indexable) { _solrPeople.AddAsync(indexable); _solrPeople.CommitAsync(); }