Vamshi Aruru
04/02/2025, 12:47 PMfloat
fields not meant to be used for sorts? I am storing createdAt of a product as a unix timestamp with the type float. When I sort based on this field in descending, some times products with higher createdAt appear below products with lower createdAt. For example check this response:
"grouped_hits": [
{
"found": 6,
"group_key": [
220641
],
"hits": [
{
"document": {
"createdAt": 1743501889,
"id": "gid-shopify-productvariant-46745147441407",
"productSlug": "boys-yellow-colo-blocked-polo-t-shirt-with-denim-shorts-set"
},
"highlight": {},
"highlights": []
}
]
},
{
"found": 6,
"group_key": [
220645
],
"hits": [
{
"document": {
"createdAt": 1743501878,
"id": "gid-shopify-productvariant-46745146654975",
"productSlug": "boys-blue-graphic-raglan-sleeves-t-shirt-with-shorts-set"
},
"highlight": {},
"highlights": []
}
]
},
{
"found": 6,
"group_key": [
220643
],
"hits": [
{
"document": {
"createdAt": 1743501885,
"id": "gid-shopify-productvariant-46745147244799",
"productSlug": "boys-white-colo-blocked-polo-t-shirt-with-denim-shorts-set"
},
"highlight": {},
"highlights": []
}
]
},
{
"found": 6,
"group_key": [
220642
],
"hits": [
{
"document": {
"createdAt": 1743501881,
"id": "gid-shopify-productvariant-46745147015423",
"productSlug": "boys-yellow-striped-collar-short-sleeves-polo-t-shirt-with-denim-shorts-set"
},
"highlight": {},
"highlights": []
}
]
}
]
1743501878 is lower than 1743501885 but appears before.
Is it because the field is float or is there something else going on? Also, is it possible to convert float field to int field?Kishore Nallan
04/02/2025, 12:51 PMVamshi Aruru
04/02/2025, 12:52 PMKishore Nallan
04/02/2025, 12:52 PMVamshi Aruru
04/02/2025, 12:53 PM