Skip to main content
The search module runs semantic (vector) search over your project’s content and powers a streaming, RAG-style question-answering endpoint.
These features require semantic search to be enabled for your project. See the Semantic Search & AI guide for setup.
The three search* functions return raw arrays of similarity-ranked results (not a PaginatedResponse); each element is { similarity, record }. askContent is different — it streams its answer (see below).

searchContent

Semantic search over content — entities, comments, and chat messages.
string
required
The search query string.
("entity" | "comment" | "message")[]
Which content types to search. Defaults to all.
string
Scope the search to a specific space.
boolean
default:"false"
Only applies with spaceId. When true, the search also covers every space nested under it — the whole subtree at any depth — not just the named space. Ignored without spaceId.
string
Scope the search to a specific conversation.
number
Maximum number of results to return.
Returns — Promise<ContentSearchResult[]>, most similar first. Each result is { sourceType, similarity, record }, where record’s type follows sourceType: an Entity for "entity", a Comment for "comment", and for "message" a ContentSearchChatMessage — the stored chat message with its sender as user (a User, or null), without reactions, files, grants or the quoted message.

searchUsers

Semantic search over the project’s users.
string
required
The search query string.
number
Maximum number of results to return.
Returns — Promise<UserSearchResult[]>, where each element is { similarity: number; record: User }.

searchSpaces

Semantic search over the project’s spaces.
string
required
The search query string.
number
Maximum number of results to return.
Returns — Promise<SpaceSearchResult[]>, where each element is { similarity: number; record: Space }.

askContent

Asks a natural-language question over your content and streams the answer back as it is generated. Unlike every other SDK function, askContent is an async generator over Server-Sent Events — you for await over it rather than awaiting a single result.
askContent streams via fetch rather than axios, so it does not get the automatic token refresh and retry that other calls get on an expired token. In SDK-managed mode, make sure a fresh access token is in place before starting a long stream.
string
required
The natural-language question to answer.
("entity" | "comment" | "message")[]
Which content types to draw from. Defaults to all.
string
Scope the answer to content within a specific space.
boolean
default:"false"
Only applies with spaceId. When true, the context lookup also covers every space nested under it — the whole subtree at any depth — so you can ask across a community and all of its channels at once. Ignored without spaceId.
string
Scope the answer to a specific conversation.
number
Maximum number of sources to draw from.
AbortSignal
Aborts the in-flight stream (e.g. when the user navigates away). You can also stop consuming by breaking out of the for await loop.
Returns — AsyncGenerator<AskContentEvent, void, unknown>. Each yielded event is one of:
An error event’s code is the server’s error code when it sent one: "search/server-error" when the server fails mid-stream, or the code of a refused request such as "project/plan-required". status is the HTTP status when the request failed before the stream opened. A missing or expired access token is refused with a bare 401 or 403 and no code, and askContent doesn’t refresh the token itself: refresh it and ask again. Completion and errors are signalled in-band as done / error events — the generator itself returns void and does not throw on a server-reported error.

matchUsers

Matches people by activity-derived interest facets, in passive mode (against the current user’s own facets) or directed mode (against a free-text topic). See the Interest Matching guide for setup and the model.
Requires a paid plan, the ai-search and interest-matching bundles, and interestMatching.enabled on the project. passive requires an identified user; directed requires one too.
"passive" | "directed"
required
"passive" or "directed".
string
The topic to match against. Required in directed mode; not allowed in passive mode. TypeScript enforces both.
number
default:"20"
Maximum number of matched users. Maximum 50.
string
Restrict candidates to users active in this space.
boolean
default:"false"
With spaceId, also include users active in the space’s subtree.
boolean
default:"false"
Request illustrative sample content per matched facet. Only honored when the project has interestMatching.exposeSampleContent on; otherwise returns 403 match/sample-content-disabled.
boolean
default:"true"
Exclude the current user from results.
Returns — Promise<{ results: UserMatchResult[] }>. Unlike searchContent/searchUsers/searchSpaces (which return bare arrays), match returns the { results } envelope, ordered by descending score.