Search
SDK methods for the federated search index — upsert resources and query across apps.
The client.search namespace upserts records into PlatformXe's federated search index and queries it. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.search |
| Python | pip install platformxe | client.search |
| Go | go get github.com/calderax/platformxe-go | client.Search |
Index a resource
Upserts are accepted asynchronously (HTTP 202). The actual write is performed by the inngest worker; results may take a few seconds to appear in queries.
await client.search.index({
app: 'lettings',
entityType: 'PROPERTY',
entityId: 'prop_abc',
title: 'Lekki Penthouse',
subtitle: '3-bed, oceanfront, Lagos',
keywords: 'lekki lagos penthouse 3 bedroom oceanfront luxury',
rank: 100,
metadata: { pricePerNightNGN: 75000, bedrooms: 3 },
});
Query
ILIKE search across title + keywords. Returns at most 20 results. Queries shorter than 2 characters return an empty array.
const results = await client.search.query({ q: 'lekki', app: 'lettings' });
for (const r of results) {
console.log(r.entityType, r.entityId, r.title);
}
results = client.search.query(q="lekki", app="lettings")
results, err := client.Search.Query("lekki", "lettings")
Index request fields
| Field | Type | Description |
|---|---|---|
app | string | Source app owning the resource. |
entityType | string | Polymorphic entity kind (PROPERTY, BOOKING, PARTNER). |
entityId | string | Stable identifier of the entity. |
title | string | Display title surfaced in search results. |
subtitle | string (optional) | Searchable snippet. |
keywords | string (optional) | Space-separated terms used in the ILIKE search. |
rank | number (optional) | Higher values rank higher in results. |
metadata | Record<string, unknown> (optional) | Echoed back in query results. |
Scopes required
| Method | Scope |
|---|---|
search.index() | search:write |
search.query() | search:read |