Files
supabase/apps/kb/scripts/search/supabase.ts
Ali WaseemandJeremias Menichelli 20e304a377 feat(kb): add search ingestion and edge function (#51843)
## Problem

We need embeddings for Kb to run a search endpoint in the Content API
and future KB search.

## Solution

This PR adds KB search backed by its own Supabase table, ingested from
the KB markdown export, and aligns the KB and docs search ingest setups.

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Test

1. Run the **KB Search Ingest** workflow, or locally run `pnpm --filter
kb search:ingest` with `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY`
set in `apps/kb/.env.local`.
2. Query the endpoint and check that the results link to
`https://supabase.com/kb/troubleshooting/...`:
   ```
   curl '<kb-url>/kb/api/search?q=connect%20timeout&limit=5'
   ```

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Jeremias Menichelli <jmenichelli@gmail.com>
2026-10-21 11:24:52 +02:00

2 lines
38 B
TypeScript

export const TABLE_NAME = 'kb_search'