public override async Task PublishedAsync(PublishContentContext context) { // TODO: ignore if this index is not configured for the content type var buildIndexContext = new BuildIndexContext(new DocumentIndex(context.ContentItem.ContentItemId), context.ContentItem, new string[] { context.ContentItem.ContentType }); // Lazy resolution to prevent cyclic dependency var contentItemIndexHandlers = _serviceProvider.GetServices <IContentItemIndexHandler>(); await contentItemIndexHandlers.InvokeAsync(x => x.BuildIndexAsync(buildIndexContext), _logger); foreach (var index in _luceneIndexManager.List()) { _luceneIndexManager.DeleteDocuments(index, new string[] { context.ContentItem.ContentItemId }); _luceneIndexManager.StoreDocuments(index, new DocumentIndex[] { buildIndexContext.DocumentIndex }); } }