November Happy Hour will be moved to Thursday December 5th.

Orderby on Displayname

Vote:
 

Hi,

When using OrderBy in a Find Query:

 query = query.OrderBy(x => x.DisplayName);

We're seeing results like this:

1. bed & onderschuifbed Doppia

2. box Ambra vlak - 2-persoons

When we would like the Ambra to be above the "bed & onderschuifbed". Is this because of the ampersand? And how can we get Find to order this by alphanumeric only (if that's a solution in this case)

Thanks!

/Mark

#187871
Feb 05, 2018 11:58
Vote:
 

Hi Mark 

I suspect the ordering is because of the &. If you wanted more control of the ordering you could add an IncludeField convention to add a custom DisplayNameOrder field to the index then order by that. The DisplayNameOrder() delegate method can then parse/remove items from the display name to allow you to fully control the ordering. 

More information:

https://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2015/5/best-pratice-for-including-information-that-does-not-exist-on-content/

https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/Customizing-serialization/Including-fields/

https://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2015/9/epifind---how-to-index-additional-fields/

David

#187899
Feb 05, 2018 21:34
Vote:
 

Hi David,

Thanks for your response. I will look at your suggestions.

/Mark

#187907
Feb 06, 2018 8:48
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.