我想在Lucene.net中对索引进行排序,如何在c#中对这个进行降序?

时间:2011-03-31 12:28:25

标签: c# sorting lucene.net

我有从Lucene.net排序结果的代码,但我需要按降序排序搜索结果:

var sort = new Lucene.Net.Search.Sort(
    new Lucene.Net.Search.SortField("date", Lucene.Net.Search.SortField.LONG));

1 个答案:

答案 0 :(得分:7)

Lucene.Net.Search.Sort构造函数有一个重载来反转排序顺序:

var sort = new Lucene.Net.Search.Sort(
    new Lucene.Net.Search.SortField("date", Lucene.Net.Search.SortField.LONG),
    true);

来自:http://www.google.com/codesearch/p?hl=en#sbnThrht2Bk/trunk/Lucene.Net/Search/Sort.cs&q=Lucene.Net.Search.Sort&sa=N&cd=1&ct=rc