Example #1
0
        protected override void PopulateIndexes(IReadOnlyList <IIndex> indexes)
        {
            if (indexes.Count == 0)
            {
                return;
            }

            const int pageSize  = 1000;
            var       pageIndex = 0;

            IMember[] members;

            //no node types specified, do all members
            do
            {
                members = _memberService.GetAll(pageIndex, pageSize, out _).ToArray();

                if (members.Length > 0)
                {
                    // ReSharper disable once PossibleMultipleEnumeration
                    foreach (var index in indexes)
                    {
                        index.IndexItems(_valueSetBuilder.GetValueSets(members));
                    }
                }

                pageIndex++;
            } while (members.Length == pageSize);
        }
Example #2
0
        protected override void PopulateIndexes(IReadOnlyList <IIndex> indexes)
        {
            if (indexes.Count == 0)
            {
                return;
            }

            const int pageSize  = 10000;
            var       pageIndex = 0;

            var mediaParentId = -1;

            if (_parentId.HasValue && _parentId.Value > 0)
            {
                mediaParentId = _parentId.Value;
            }

            IMedia[] media;

            do
            {
                media = _mediaService.GetPagedDescendants(mediaParentId, pageIndex, pageSize, out var total).ToArray();

                if (media.Length > 0)
                {
                    // ReSharper disable once PossibleMultipleEnumeration
                    foreach (var index in indexes)
                    {
                        index.IndexItems(_mediaValueSetBuilder.GetValueSets(media));
                    }
                }

                pageIndex++;
            } while (media.Length == pageSize);
        }
        protected void IndexAllContent(int contentParentId, int pageIndex, int pageSize, IReadOnlyList <IIndex> indexes)
        {
            IContent[] content;

            do
            {
                content = _contentService.GetPagedDescendants(contentParentId, pageIndex, pageSize, out _).ToArray();

                if (content.Length > 0)
                {
                    var valueSets = _contentValueSetBuilder.GetValueSets(content).ToList();

                    // ReSharper disable once PossibleMultipleEnumeration
                    foreach (var index in indexes)
                    {
                        index.IndexItems(valueSets);
                    }
                }

                pageIndex++;
            } while (content.Length == pageSize);
        }
Example #4
0
        protected override void PopulateIndexes(IReadOnlyList <IIndex> indexes)
        {
            if (indexes.Count == 0)
            {
                return;
            }

            const int pageSize  = 10000;
            var       pageIndex = 0;

            var contentParentId = -1;

            if (_parentId.HasValue && _parentId.Value > 0)
            {
                contentParentId = _parentId.Value;
            }

            IContent[] content;

            do
            {
                if (!_publishedValuesOnly)
                {
                    content = _contentService.GetPagedDescendants(contentParentId, pageIndex, pageSize, out _)
                              .ToArray();
                }
                else
                {
                    //add the published filter
                    //note: We will filter for published variants in the validator
                    content = _contentService.GetPagedDescendants(contentParentId, pageIndex, pageSize, out _,
                                                                  _publishedQuery, Ordering.By("Path", Direction.Ascending)).ToArray();
                }

                if (content.Length > 0)
                {
                    // ReSharper disable once PossibleMultipleEnumeration
                    foreach (var index in indexes)
                    {
                        index.IndexItems(_contentValueSetBuilder.GetValueSets(content));
                    }
                }

                pageIndex++;
            } while (content.Length == pageSize);
        }
    protected override void PopulateIndexes(IReadOnlyList <IIndex> indexes)
    {
        if (indexes.Count == 0)
        {
            _logger.LogDebug(
                $"{nameof(PopulateIndexes)} called with no indexes to populate. Typically means no index is registered with this populator.");
            return;
        }

        const int pageSize  = 10000;
        var       pageIndex = 0;

        var mediaParentId = -1;

        if (_parentId.HasValue && _parentId.Value > 0)
        {
            mediaParentId = _parentId.Value;
        }

        IMedia[] media;

        do
        {
            media = _mediaService.GetPagedDescendants(mediaParentId, pageIndex, pageSize, out _).ToArray();

            if (media.Length > 0)
            {
                // ReSharper disable once PossibleMultipleEnumeration
                foreach (IIndex index in indexes)
                {
                    index.IndexItems(_mediaValueSetBuilder.GetValueSets(media));
                }
            }

            pageIndex++;
        }while (media.Length == pageSize);
    }