Elad Chen
11/24/2025, 9:41 AMField cells.number_value cannot be a sortable field.
const spreadsheet_rows = {
name: "spreadsheet_rows",
enable_nested_fields: true,
fields: [
{ name: "id", type: "string" },
{ name: "account_id", type: "string" },
{ name: "spreadsheet_id", type: "string", sort: true },
// { name: "address.zip", type: "string" },
{ name: "cells", type: "object[]" },
{ name: "cells.key", type: "string[]" },
{ name: "cells.number_value", type: "int64[]", optional: true, sort: true },
{ name: "cells.string_value", type: "string[]", optional: true, sort: true },
{ name: "cells.boolean_value", type: "bool[]", optional: true, sort: true },
{ name: "cells.status", type: "string[]", optional: true },
{ name: "cells.updated_at", type: "int64[]", optional: true },
],
default_sorting_field: "spreadsheet_id",
}Kishore Nallan
11/24/2025, 9:55 AMint64[] cannot be a sortable field. It must be a single valued type like int64 or int32.Elad Chen
11/24/2025, 9:55 AMKishore Nallan
11/24/2025, 9:56 AMElad Chen
11/24/2025, 9:56 AM{ name: "cells.*", type: "object" },
{ name: "cells.*.key", type: "string" },
{ name: "cells.*.status", type: "string", optional: true },
{ name: "cells.*.updated_at", type: "int64", optional: true },
{ name: "cells.*.number_value", type: "int64", optional: true, sort: true },
{ name: "cells.*.string_value", type: "string", optional: true, sort: true },
{ name: "cells.*.boolean_value", type: "bool", optional: true, sort: true },Elad Chen
11/24/2025, 9:56 AMKishore Nallan
11/24/2025, 9:58 AMElad Chen
11/24/2025, 10:04 AMsort_by parameter in the search request.
But perhaps I can use "conditions"
without having to make the field sortable?Kishore Nallan
11/24/2025, 10:05 AM_eval() still needs a condition which will produce a singlular true/false value.Elad Chen
11/24/2025, 10:09 AM{
"sort_by": "cells.line_1.string_value:desc"
}
Would work then based on the above?Elad Chen
11/24/2025, 10:10 AM{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "cells.line_1.string_value",
"optional": true,
"sort": true,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "string"
}Elad Chen
11/24/2025, 10:18 AMKishore Nallan
11/24/2025, 10:21 AMElad Chen
11/24/2025, 10:29 AMaddress_line_1)
Here's what I ended up doing in order to achieve a dynamic
schema, and make it sortable:
const orders = {
name: "orders",
enable_nested_fields: true,
fields: [
{ name: "id", type: "string" },
{ name: "account_id", type: "string" },
{ name: "order_id", type: "string", sort: true },
{ name: "cells.*", type: "object" },
{ name: "cells.*.key", type: "string" },
{ name: "cells.*.status", type: "string", optional: true },
{ name: "cells.*.updated_at", type: "int64", optional: true },
{ name: "cells.*.number_value", type: "int64", optional: true, sort: true },
{ name: "cells.*.string_value", type: "string", optional: true, sort: true },
{ name: "cells.*.boolean_value", type: "bool", optional: true, sort: true },
],
default_sorting_field: "order_id",
}
const rows = await client
.collections('orders')
.documents()
.search({
q: '*',
sort_by: 'cells.address_line_1.string_value:desc',
})
The above works from what I can tell. The documents added to the collections are marked as sortable, and work when used in a search request.
Is this the expected behavior?Elad Chen
11/24/2025, 12:08 PMKishore Nallan
11/24/2025, 12:10 PMElad Chen
11/24/2025, 12:12 PM{
"cells": {
"company_domain": {
"string_value": "possimus.net"
},
"company_size_min": {
"number_value": 4722
},
"emails": {
"string_value": "janet+zawadzki@centurytel.dev, koichi_romero@aim.com"
},
"full_name": {
"string_value": "Muhammed Ikeda"
},
"job_title": {
"string_value": "Principal Web Engineer"
},
"linkedin_profile": {
"string_value": "https://www.linkedin.com/in/Abdullahi_Magnússon"
},
"location": {
"string_value": "1035 Hilma Mills, Jaskolskifort, 23816, Slovakia (Slovak Republic)"
},
"phones": {
"string_value": "+221 45 297 4875, +855 39 162 286"
},
"seniority": {
"string_value": "Central"
}
},
"id": "49991",
"order_id": "019ab580-cbf2-7224-9437-5cd8c867cb52",
"account_id": "1"
}Kishore Nallan
11/24/2025, 12:12 PMElad Chen
11/24/2025, 1:31 PMKishore Nallan
11/24/2025, 2:12 PM