Reputation: 323
I am using Lucene.NET and getting search results sorted by 'Date' field.
Here are some example code of search results sorted by date:
var collector = TopFieldCollector.Create(sortByDate, nDocuments, false, true, true, false);
indexSearcher.Search(query, collector);
var scoreDocs = collector.TopDocs().ScoreDocs;
I need to sort results by some other field which not known after I get the results.
For example, after the initial results which sorted by date, I need to sort by Name/From/etc.
Is it possible sort again the collector/ScoreDocs?
Thanks.
Upvotes: 3
Views: 1013
Reputation: 9964
You cannot sort again scoreDocs because it only contains the top documents, but you can run this query again sorting on a different field.
Upvotes: 1