Reputation: 715
I'm using Sitecore 6.5 and wanted to know in what sort order lucene arrange the search results by default? Also can we change(replace) this default behavior with our custom sort logic?
Upvotes: 1
Views: 2167
Reputation: 1715
Documents are sorted by relevance by default. You can sort by any field, here's the simple example (within the SearchContext):
var searchHits = new SearchHits(searchContext.Searcher.Search(query, new Sort("__created", true)));
var results = searchHits.FetchResults(0, 100);
Where "__created" is a field you want to sort by.
Upvotes: 5