internal sealed class FoosByClassificationOrderedByCreatedIndex : AbstractIndexCreationTask<Foo>
{
public FoosByClassificationOrderedByCreatedIndex()
{
Map = Foos => from foo in Foos
select new
{
foo.Classification,
Created = this.MetadataFor(foo).Value<DateTime>("Created"),
};
}
public override IndexDefinition CreateIndexDefinition()
{
var indexDefinition = base.CreateIndexDefinition();
indexDefinition.SortOptions["Created"] = SortOptions.None;
return indexDefinition;
}
}
Note that for dates, you don't need to do anything.
This is identical to the defaults.