SenseNet / sensenet

Open Source Content Services Platform written in .NET
https://sensenet.com
GNU General Public License v2.0
174 stars 111 forks source link

Number fields are used as string #2118

Open kavics opened 3 weeks ago

kavics commented 3 weeks ago

Sorting by any Number field causes wrong order. The following code in the "Docs2_BasicConcepts_OrderBy_Id_Asc" test (sn-client-net, TestsForDocs/BasicConcepts.cs)

var result = await repository.LoadCollectionAsync(new LoadCollectionRequest
{
    Path = "/Root/Content/Cars",
    OrderBy = new[] { "Price asc" }
}, cancel);

Result:

  120000
 1200000
16900000
18600000
 2240000
38000000
 4930000
60000000
 7850000
 8350000

Another symptom:

The following code in the "Docs2_BasicConcepts_Filter_Id" test (sn-client-net, TestsForDocs/BasicConcepts.cs) the filter is ineffective because it also returns values that are too small:

await repository.LoadCollectionAsync(new LoadCollectionRequest
{
    Path = "/Root/Content/Cars",
    ChildrenFilter = "Price gt 1000000.0m" // The "m" suffix is required in case of Number fields
}, cancel)