Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

EPiFind Nested Sorting Bad Request

$
0
0

Hi,

I am trying to sort some objects by a nesten field, but cannot seem to get it working. I would like to sort all the results, (each containing the EnumerableField) based on the first element matching the z-lambda function of all the elements.

This is the nested sorting function I am using, which produces a "EPiServer.Find.ServiceException: 'The remote server returned an error: (400) Bad Request".

:

search.OrderBy(x => x.EnumerableField,
         y => y.DecimalNumber,
         z => z.ValidTo.After(DateTime.Now) & z.IsActive.Match(true) & z.ValidFrom.Before(DateTime.Now));

I have also tested sorting with .FirstOrDefault(...) but to no avail. As opposed to the previous approach, this one does not seem to do anything:

search.OrderBy(x => x.EnumerableField.FirstOrDefault(z => z.ValidTo > DateTime.Now & z.IsActive & z.ValidFrom < DateTime.Now).DecimalNumber);

Is there something I am missing, or is this not possible?

The find-index objects is grouped in this way:

{"MetaClassId$$number": ..,"GetTimestamp$$date": ..,
    ...,"EnumerableField": [
        {"___types": ["...","System.Object"
            ],"DecimalNumber$$number": 0.9,"ValidFrom$$date": "2019-01-02T23:00:00Z","ValidTo$$date": "2019-10-17T22:00:00Z","Title$$string": "...","ID$$number": 1,"$type": "....Core","IsActive$$bool": true
        },
        {"___types": ["...","System.Object"
            ],"DecimalNumber$$number": 0.2,"ValidFrom$$date": "2019-01-02T23:00:00Z","ValidTo$$date": "2019-10-17T22:00:00Z","Title$$string": "...","ID$$number": 1,"$type": "....Core","IsActive$$bool": true
        },
    ],
    ..."IsPendingPublish$$bool": false,
}

Viewing all articles
Browse latest Browse all 9076

Trending Articles