* Add sort handlers for create and update date * Make things sealed * Update the field names --------- Co-authored-by: Elitsa <elm@umbraco.dk>
16 lines
553 B
C#
16 lines
553 B
C#
using Umbraco.Cms.Core.DeliveryApi;
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
namespace Umbraco.Cms.Api.Delivery.Indexing.Sorts;
|
|
|
|
public sealed class CreateDateSortIndexer : IContentIndexHandler
|
|
{
|
|
internal const string FieldName = "createDate";
|
|
|
|
public IEnumerable<IndexFieldValue> GetFieldValues(IContent content)
|
|
=> new[] { new IndexFieldValue { FieldName = FieldName, Value = content.CreateDate } };
|
|
|
|
public IEnumerable<IndexField> GetFields()
|
|
=> new[] { new IndexField { FieldName = FieldName, FieldType = FieldType.Date } };
|
|
}
|