I am trying to sort a result but it seams to only apply to x first charaters I got a SearchTitle where many pages begins whith the same 100-200 chars, when i try to sort on those SearchTitles they does not get sorted. Anyone know something about this?
Hi Niklas can you give some example code or results?
Results (the orange marked ar not ordered):
In this case if i place the orange marked text in the beginning it will be corectly sorted.
Can you post the Find query you are using?
Well, it is this thats important for sorting (otherwise its only filtering it is the Alphabetically sorting that is not working after x charaters tryed whitout ThenBy, Not helping):
query = query
.OrderByDescending(item => item.SearchMetaData["OrderByDate"].DateTimeValue)
query = query
.OrderBy(item => item.SearchMetaData["OrderByDate"].DateTimeValue)
query = query.OrderBy(item => item.SearchTitle).ThenByScore();
query = query.OrderByDescending(item => item.SearchTitle).ThenByScore();
.Skip(filter.PageIndex * filter.PageSize)
I took a look myself and them getting the same results. I checked whether this varies between a regular search or unified but with the same result. I do know that unified will encode some of the characters, but that still doesn't explain the order issue.
I would raise this as a bug with Episerver. If there is a known limitation it should be stated.
What I would suggest in the meantime if possible is to have a separate property for sorting or trying something like .OrderBy(x => x.SearchTitle.GetHashCode())
Janaka, Thanks for your answer... I will make a case conserning this to Epi...
Ansver on ticket:
Daniel (EPiServer/Ektron Support)
4 apr. 9:22 fm EDT
Hi Niklas, Only the first 50 characters are used when sorting (orderby). I believe this limit somehow lies in how Elastic Search works and that fact the these fields are analyzed and tokenized. I'm gonna try and dig deeper and see if there a way around this.
18 apr. 5:14 fm EDT
Hi Niklas, Sorry, it doesn't seem to be any easy way round this. I believe this limit is for performance. You should be split the data and put it in different fields and sort on both but I don't know how I feel about that approach.