private void CreateTasksForType(string type)
 {
     foreach (var contentItem in _contentManager.Query(VersionOptions.Published, new [] { type }).List())
     {
         _indexingTaskManager.CreateUpdateIndexTask(contentItem);
     }
 }
 void CreateIndexingTask(PublishContentContext context, ContentPart part)
 {
     // "Unpublish" case: Same as "remove"
     if (context.PublishingItemVersionRecord == null)
     {
         _indexingTaskManager.CreateDeleteIndexTask(context.ContentItem);
         return;
     }
     // "Publish" case: update index
     _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
 }
        public void Sweep()
        {
            var contentItemsLists = _indexTaskBatchManagementService.GetNextBatchOfContentItemsToIndex();

            foreach (var contentItemsList in contentItemsLists)
            {
                foreach (var contentItem in contentItemsList)
                {
                    _indexingTaskManager.CreateUpdateIndexTask(contentItem);
                }
            }
        }
        public void Refresh()
        {
            int contentItemId;

            if (!int.TryParse(ContentItem, out contentItemId))
            {
                Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
                return;
            }

            var contentItem = _contentManager.Get(contentItemId);

            _indexingTaskManager.CreateUpdateIndexTask(contentItem);

            Context.Output.WriteLine(T("Content Item marked for reindexing"));
        }
        public void CreateNextIndexingTaskBatch(string contentTypeName, string currentBatchIndex)
        {
            var contentItems = _contentManager.Query(contentTypeName).Slice(int.Parse(currentBatchIndex), BatchSize).ToList();

            foreach (var contentItem in contentItems)
            {
                _indexingTaskManager.CreateUpdateIndexTask(contentItem);
            }

            if (contentItems.Count == BatchSize)
            {
                _jobsQueueService.Enqueue("ICreateUpdateIndexTaskService.CreateNextIndexingTaskBatch", new Dictionary <string, object> {
                    { "contentTypeName", contentTypeName }, { "currentBatchIndex", (int.Parse(currentBatchIndex) + BatchSize).ToString() }
                }, JobPriority);
            }
        }
Exemple #6
0
        private void CreateTasksForType(string type)
        {
            var  index = 0;
            bool contentItemProcessed;

            // todo: load ids only, or create a queued job
            // we create a task even for draft items, and the executor will filter based on the settings

            do
            {
                contentItemProcessed = false;
                var contentItemsToIndex = _contentManager.Query(VersionOptions.Latest, new [] { type }).Slice(index, PageSize);

                foreach (var contentItem in contentItemsToIndex)
                {
                    contentItemProcessed = true;
                    _indexingTaskManager.CreateUpdateIndexTask(contentItem);
                }

                index += PageSize;
            } while (contentItemProcessed);
        }
 void CreateIndexingTask(ContentContextBase context, ContentPart part)
 {
     _indexingTaskManager.CreateUpdateIndexTask(context.ContentItem);
 }