Search the catalog
Drive search only searches Drive. This searches across everything that has been synced, in one query, with analysis attached.
{ "name": "search_things", "arguments": { "query": "invoice 2024", "kind": "pdf", "limit": 50 } }| Argument | Does |
|---|---|
query |
words to match — all of them must appear |
kind |
restrict to one kind: pdf, image, text, data, xlsx, doc, email, calendar, file |
limit |
1–200, 50 by default |
Omit the query entirely to list the most recent things of a kind.
What it matches
Section titled “What it matches”Titles, paths, and text extracted by analysis — which is the part that makes it worth having. A scanned PDF matches on its OCR; an email matches on its body; a spreadsheet matches on cells. None of that is in the filename, and none of it is searchable in the resource the thing came from.
Which means search quality is downstream of analysis. A thing that has been synced but not yet analyzed matches on its path and little else.
Then get the whole of one
Section titled “Then get the whole of one”{ "name": "get_thing", "arguments": { "id": "..." } }That returns every place the thing lives, what analysis extracted from each of them, the per-step results, and up to 8,000 characters of body text.
A thing groups references. The same document in a bucket and in Drive is one thing with two references, not two things — which is what makes a cross-resource catalog worth more than two searches.
Getting the bytes
Section titled “Getting the bytes”get_thing gives you an excerpt, not the file. The bytes stay in the resource they came from, so
export_things is how they come back out. See Export.
Isolation
Section titled “Isolation”Search is the one layer row-level security cannot reach. OpenSearch holds its own copy of enough of the catalog to answer a query, and no Postgres policy applies to it.
The application never queries the underlying index — only a per-tenant filtered alias that carries the tenant filter with it. A leak here would be invisible, with no error and just results that should not be there, which is why it is asserted directly rather than inferred. See Tenancy.
Designed for millions of things per tenant: cursor pagination, OpenSearch as the query path, and no
count(*) anywhere on it. A dry run before something expensive reports matches 47,213 things off
the index rather than by counting rows.