Try our conversational search powered by Generative AI!

Episerver Search Service Sort Order



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 :

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.



Apr 01, 2019 11:50

Hi Paul,

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.

Apr 01, 2019 16:20

Hi Gustav,

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?



Apr 01, 2019 18:31

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

Apr 02, 2019 9:21

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.

I hope this helps!

Apr 02, 2019 9:43

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 api rather than the Episerver Search Api's to query the index.



Apr 03, 2019 10:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.