Search the catalogue by writing code
searchRun JavaScript against the whole catalogue document — every table, its dimensions, coverage and small-dimension options — in an isolated sandbox with no network. Use it to answer questions the fixed verbs make awkward: 'which tables have both an SA2 geography and a quarterly frequency?', 'list every dimension name and how often it appears', 'find codelists whose labels mention rent'. Your code runs inside an async function with catalogue in scope; return a JSON-serialisable value; console.log output is captured.
// The catalogue object available in search():
interface Catalogue {
provenance: { runId: string; observedAt: string };
corpus: { tables: number; seriesConfirmed: number; seriesImpliedByMetadata: number; density: number };
tables: Record<string, { // keyed by table id, e.g. catalogue.tables.CPI
id: string; name: string|null; description: string|null; seriesCount: number;
frequencies: string[]; coverage: { from: string|null; to: string|null }; density: number|null;
family: string|null; geography: string|null; topics: string[];
dimensions: { id: string; position: number; codelist: string|null; optionCount: number; literal: boolean }[];
}>;
options: {
literal: Record<string, Record<string, string|null>>; // codelist id -> { code: label } for small codelists (<=64 options)
branded: Record<string, number>; // large codelists -> option count (use abs.searchOptions in execute)
};
}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript. `catalogue` is in scope. Must return a value. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| logs | Yes | ||
| error | No | ||
| result | No | ||
| truncated | No |