Sorting on Multiple Fields

前端 未结 5 1517
执笔经年
执笔经年 2021-01-04 19:31

Does Nest support sorting on multiple fields? For example, say I want to sort first by FieldA ascending and then by FieldB descending.

My current approach looks some

5条回答
  •  春和景丽
    2021-01-04 19:49

    I recent version of Nest the correct way of sortin on multiple fileds would be:

    .Sort(s => s
        Field(f => f
            .Field("FieldA")
            .Order(SortOrder.Ascending)
        )
        .Field(f => f
            .Field("FieldB")
            .Order(SortOrder.Ascending)
        )
    );
    

提交回复
热议问题