Fetch only table fields and validate
This commit is contained in:
parent
79ca65e39a
commit
120d5d953d
|
@ -73,6 +73,19 @@ export async function search(
|
||||||
const table = await sdk.tables.getTable(options.tableId)
|
const table = await sdk.tables.getTable(options.tableId)
|
||||||
options = searchInputMapping(table, options)
|
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<Row>
|
let result: SearchResponse<Row>
|
||||||
if (isExternalTable) {
|
if (isExternalTable) {
|
||||||
span?.addTags({ searchType: "external" })
|
span?.addTags({ searchType: "external" })
|
||||||
|
|
Loading…
Reference in New Issue