public async Task SaveDocumentToDb(FullDocumentInfo document, CancellationToken cancellationToken) { var response = await elasticClient.IndexAsync(new IndexRequest <DocumentInfoModel>(options.IndexName, document.Id.ToString()) { Document = new DocumentInfoModel { Id = document.Id, ModificationDate = document.ModificationDate, FileName = document.FileName, Text = textHighlighter.EscapeText(document.ExtractedText), FolderId = document.FolderId.ToString(), ParentFoldersPath = document.ParentFoldersPath.Select(x => x.ToString()).ToArray() } }, cancellationToken); CheckResponse(response, "Error during saving document into db"); await contentStorage.Save(document.Id.ToString(), ContentCategory, document.Content, cancellationToken); }
public async Task <string> SaveTempContent(IContent content, CancellationToken cancellationToken) => (await contentStorage.Save(Guid.NewGuid().ToString(), options.ContentCategory, content, cancellationToken)).Id;