diff --git a/packages/server/src/sdk/app/rows/search.ts b/packages/server/src/sdk/app/rows/search.ts index 1ccd89639b..ea0b3bf5b6 100644 --- a/packages/server/src/sdk/app/rows/search.ts +++ b/packages/server/src/sdk/app/rows/search.ts @@ -73,6 +73,19 @@ export async function search( const table = await sdk.tables.getTable(options.tableId) options = searchInputMapping(table, options) + const visibleTableFields = Object.keys(table.schema).filter( + f => table.schema[f].visible !== false + ) + + if (options.fields) { + const tableFields = visibleTableFields.map(f => f.toLowerCase()) + options.fields = options.fields.filter(f => + tableFields.includes(f.toLowerCase()) + ) + } else { + options.fields = visibleTableFields + } + let result: SearchResponse if (isExternalTable) { span?.addTags({ searchType: "external" })