We are currenlty working on using the default Episerver Search and we have a problem with sorting the search results.
We are following the documentation found here :https://world.episerver.com/documentation/developer-guides/CMS/search/Search-integration/
However there is no mention of a SortQuery option.
Does anyone know if this is possible?
We would like to order the results by PublishedStartDate if possible.
I might have misunderstood what you are after but as the result yielded is an IEnumerable you could use Linq and OrderBy(x => x.StartPublishDate) or OrderByDescending(x => x.StartPublishDate) on the final collection.
In Lucence there is the ability to use a sortfield when querying for data.
Is there a way to use this in Episerver Search?
I presume we need to write our own implementation to handle this possibly?
If I am not wrong, you are willing to pass a sort property name in your search to get results sorted on basis of this sort property, right?
Example of function:
Sort property type
Implementation of OrderByDescending
Search is based on lucene but I dont think that PublishedStartDate is indexed by default. Dejan Caric has written a nice blogpost about extending the index to add a new property (such as publish date) and querying for it. https://www.dcaric.com/blog/extending-episerver-search-part-2
I hope this helps!
Thanks for the help guys.
Praful thanks for the info, though I think that solution works with Episerver Find, where we are dealing with Episerver Search.
Gustav that looks to be what we are looking for, i suppose we have to use lucence.net api rather than the Episerver Search Api's to query the index.