Gets indexes updating based on content type changes

This commit is contained in:
Shannon
2018-10-30 17:32:27 +11:00
parent 9416c5f638
commit a383309e46
6 changed files with 105 additions and 60 deletions

View File

@@ -405,28 +405,20 @@ namespace Umbraco.Core.Services.Implement
}
}
/// <summary>
/// Gets a collection of <see cref="IContent"/> objects by the Id of the <see cref="IContentType"/>
/// </summary>
/// <param name="id">Id of the <see cref="IContentType"/></param>
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
public IEnumerable<IContent> GetByType(int id)
public IEnumerable<IContent> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter, Ordering ordering = null)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
var query = Query<IContent>().Where(x => x.ContentTypeId == id);
return _documentRepository.Get(query);
}
}
if(pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex));
if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));
if (ordering == null)
ordering = Ordering.By("sortOrder");
internal IEnumerable<IContent> GetPublishedContentOfContentType(int id)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
var query = Query<IContent>().Where(x => x.ContentTypeId == id);
return _documentRepository.Get(query);
return _documentRepository.GetPage(
Query<IContent>().Where(x => x.ContentTypeId == contentTypeId),
pageIndex, pageSize, out totalRecords, filter, ordering);
}
}