Ability to Sort By Dictionary Value?

Vote:
 

We're using Find 13.4.5, and attempting to use a dictionary to store computed prices where the keys are a string composed of specifc account details. We'd like to allow users to sort products by this computed value, but calling OrderBy/OrderByDescending seem to output the json request without the key IE:

"sort":[{"PriceDictionaryMethodName$$number":{"missing":"_last","unmapped_type":"double"}}]

where PriceDictionaryMethodName is a static method returning a Dictionary<string, decimal>. This results in no sort being applied. Modifying the request to include the key appears works correctly IE:

"sort":[{"PriceDictionaryMethodName.Key$$number":{"missing":"_last","unmapped_type":"double"}}]

seems to order them correctly. Is there a way to force this in the json query? I've tried Dictionary2Find, but that doesn't seem to work. It would be great to have this work correctly for projections too.

#267684
Dec 01, 2021 22:51
Johan Kronberg - Dec 02, 2021 6:32
Is this UnifiedSearch or searching for a set type?
Michael Clausing - Dec 03, 2021 1:19
It's for a specific type using ITypeSearch.
Johan Kronberg - Dec 03, 2021 7:52
Do you have any alternatives tried out or in mind? How many keys are in the dictionary typically and how big is the model that owns the dictionary property?

Add a support ticket if you haven't already.
* 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.