Example #1
0
        /// <summary>
        /// Creates a IDocumentIndex instance for a specific content item id. If the content 
        /// item is no more published, it returns null.
        /// </summary>
        private IDocumentIndex ExtractDocumentIndex(ContentItem contentItem) {
            // ignore deleted or unpublished items
            if (contentItem == null || (!contentItem.IsPublished() && !contentItem.HasDraft())) {
                return null;
            }

            var documentIndex = _indexProvider.New(contentItem.Id);

            // call all handlers to add content to index
            _contentManager.Index(contentItem, documentIndex);
            return documentIndex;
        }