Search
The search parameter allows you to perform a keyword search across one or more columns in your table.
Search Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
columns | string[] | Yes | The specific fields to search within. |
query | string | Yes | The keyword or phrase to search for. |
This example searches for "Alice" in the first_name and email columns.
- Manta data table
- PostgreSQL
TypeScript
const users = await manta.fetchAllRecords({
table: "users",
fields: ["user_id", "first_name", "last_name", "email"],
search: {
columns: ["first_name", "email"],
query: "Alice",
},
page: 1,
list: 10,
});
TypeScript
const users = await manta.fetchAllRecords({
db: 'analytics_pg',
table: "users",
fields: ["user_id", "first_name", "last_name", "email"],
search: {
columns: ["first_name", "email"],
query: "Alice",
},
page: 1,
list: 10,
});
Combined search and filter
You can combine a keyword search with a where filter to refine your results even further. This example shows how to search for users where either the first_name or email contains the term 'Alice' when the status field is active.
- Manta data table
- PostgreSQL
TypeScript
const users = await manta.fetchAllRecords({
table: "users",
fields: ["user_id", "first_name", "last_name", "email"],
where: {
status: "active",
},
search: {
columns: ["first_name", "email"],
query: "Alice",
},
page: 1,
list: 5,
})
TypeScript
const users = await manta.fetchAllRecords({
db: 'analytics_pg',
table: "users",
fields: ["user_id", "first_name", "last_name", "email"],
where: {
status: "active",
},
search: {
columns: ["first_name", "email"],
query: "Alice",
},
page: 1,
list: 5,
});