Son Do
Jul 26, 2018
  9308
(3 votes)

Sorting issue in Episerver Find 13.0.1

We have known an issue about sorting in Find 13.0.1 that we can reproduce

  • Create a developer index in find.episerver.com.
  • Create some properties for string, DateTime, int type for a page type
  • Create some page using those page types.
  • Run the site and index the content.
  • In the test page, create query and sort by Date or SortNumber.
var query = _searchClient.Search<BasePage>()
    .FilterForVisitor()
    .OrderBy(x => x.MyOwnDate)
    .Select(x => new SearchItem
    {
        PageTitle = x.Name,
MyOwnDate = x.MyOwnDate, SortNumber = x.SortNumber, TeaserText = x.TeaserText, ID = x.ContentLink.ID }) .Take(100); model.SearchResults = query.GetResult().Hits.Select(x => x.Document).ToList();

And the bug is published https://world.episerver.com/support/Bug-list/bug/FIND-3596 and will be fixed in next version.

While waiting for upgrading to the next version, we can have a way of working around:

.OrderBy(x => x.MyOwnDate, null, null, false);
// Or
.OrderBy(x => x.MyOwnDate, null, SortOrder.Ascending, false);
// For order descending, we had:
.OrderBy(x => x.MyOwnDate, null, SortOrder.Descending, false);

We need to change OrderBy clause and make sure that the ignoreUnmapped parameter is false.

We can apply the same working around for other types: date, int, ...

Hope this helps your work.

/Son Do

Jul 26, 2018

Comments

Kane Made It
Kane Made It Jul 26, 2018 10:55 AM

Great, thanks! I received several questions from partner yesterday. Not sure if we have official location to create a bug or request from user. She created a thread on World only.

Son Do
Son Do Jul 26, 2018 03:28 PM

Hi Khanh, World forum is a place that we can discuss and post bug. Currently, we don't have another channel for developers do that.

ngoanmai
ngoanmai Aug 31, 2018 07:48 AM

Thank @Khanh for helping with this question!

Hi @SonDo, I tried following your instruction but it still does not work.

I have the ArticlePage with [ArticleDate] which is my custom field. Trying to make the very simple search query with the sorting(tried both Assending and Dessending) but the result was not sorted. 

Please see the attached image for more detail(https://ibb.co/ePKHL9).

The field definition:

public virtual DateTime ArticleDate { get; set; }

And the search query with the sorting:

var articles1 = _searchClient.Search(Language.English)
.CurrentlyPublished()
.PublishedInCurrentLanguage()
.Filter(searchFilter)
.ExcludeDeleted()
.OrderBy(a => a.ArticleDate, null, SortOrder.Ascending, false)
.Take(pageSize)
.StaticallyCacheFor(TimeSpan.FromMinutes(5))
.GetContentResult();

var dates = articles1.Select(x => x.ArticleDate);

Do you have any suggestion for it?

Thanks so much :).

Son Do
Son Do Sep 25, 2018 04:34 AM

Hi Ngoan, 

Sorry for the late comment. I tried your search query in my Alloy site and it worked properly.

I'm not sure what happens to your site or your search query. Have you got more information that I can trace the issue?

/Son Do

Son Do
Son Do Sep 25, 2018 04:38 AM

Hi Ngoan, 

Sorry for the late comment. I tried your search query in my Alloy site and it worked properly.

I'm not sure what happens to your site or your search query. Have you got more information that I can trace the issue?

/Son Do

Sheider
Sheider Oct 5, 2018 03:35 AM

Hey thanks for this! One thing I noticed after upgrading to 13.0.3 I was still seeing this issue. However it was bizzare because I would not see this behavior on my local solution with a find development index but this issue came to light on the development environment with the clients purchased development find license. I have since added this fix and all works as it should now, but it may be worth investigating on 13.0.3 as well.

Christian Simpson
Christian Simpson Oct 23, 2018 11:22 PM

Hi,

I am seeing the exact same behavior that Sean mentioned. On all 13.0.x versions of Find (including 13.0.3 where the issue was supposedly fixed), I only see this sorting bug on indices which are provisioned as part of a customer's DxC license (https://es-us-api01.episerver.com). I do not see this behavior with indices created on find.episerver.com (https://es-eu-dev-api01.episerver.net).

That being said, this workaround seems to work on all 13.0.x versions of Find for indices which are provided by DxC. Thank you for the valuable info!

Thorbjørn Nielsen
Thorbjørn Nielsen Dec 3, 2018 01:40 PM

Hi

We still having the same problem with Find 13.0.5.0 after getting a new find index on https://es-eu-api03.episerver.net

I dont get the same behovior on https://es-eu-dev-api01.episerver.net locally.

I hade to use the same workaround to make it work.

Torbjörn Hansson
Torbjörn Hansson Dec 20, 2018 12:36 PM

I have the same issue when sorting on nested objects with Find 13.0.5 on DXC environment. Working on demo index. The result seem to be sorted but in different fragments.

Dave Johnson
Dave Johnson Jan 18, 2019 02:35 PM

Hi @SonDo

We are having the same sorting issue with production indexes located on https://es-eu-api03.episerver.net.

Using a dev index on https://es-eu-dev-api01.episerver.net with the same content and Nuget package version (13.0.1) seems to work absolutely fine.

Is this a an index-side code issue rather than related to the client-side library?

The bug report linked to from this post doesn't have a fix version associated with it, so has it been fixed or not? - https://world.episerver.com/support/Bug-list/bug/FIND-3596

Dave

Please login to comment.
Latest blogs
I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog

ExcludeDeleted(): Prevent Trashed Content from Appearing in Search Results

Introduction In Optimizely CMS, content that is moved to the trash can still appear in search results if it’s not explicitly excluded using the...

Ashish Rasal | Nov 7, 2024

CMS + CMP + Graph integration

We have just released a new package https://nuget.optimizely.com/package/?id=EPiServer.Cms.WelcomeIntegration.Graph which changes the way CMS fetch...

Bartosz Sekula | Nov 5, 2024

Block type selection doesn't work

Imagine you're trying to create a new block in a specific content area. You click the "Create" link, expecting to see a CMS modal with a list of...

Damian Smutek | Nov 4, 2024 | Syndicated blog

.NET 8 FAQ

I have previously written about .NET compatibility in general and .NET 8 in particular, see blog posts here , here and here . With the end of suppo...

Magnus Rahl | Nov 4, 2024