Files
supabase/apps/docs
claude[bot]andClaude ffef679f70 chore(docs): add hasResults to docs_search_v2_search_submitted (#51541)
<!-- claude-slack-attribution -->
_Requested by **Pam Chia** · [Slack
thread](https://supabase.slack.com/archives/C076KTY11DF/p1791767641595649?thread_ts=1791767641.595649&cid=C076KTY11DF)_

## Problem

**Before:** `docs_search_v2_search_submitted` (added in #51146) fires
when a Search V2 query settles on either the `results` or the
`noResults` state, but it only sends `query`. A search that found
nothing looks the same as one that found results, and no other Search V2
event carries the outcome, so the no-results rate for Search V2 can't be
computed.

**After:** the event also sends `hasResults`. It's `true` when the
endpoint returned at least one result and `false` when it returned none,
so zero-result searches can be counted and their queries inspected.

## Solution

- `packages/common/telemetry-constants.ts`:
`DocsSearchV2SearchSubmittedEvent` gains a doc-commented `hasResults:
boolean` property.
- `apps/docs/features/SearchV2/SearchV2Dialog.tsx`: the existing fire
site sends `hasResults: searchState.status === 'results'`. The
`useDocsSearchV2` reducer only sets `results` when the response has at
least one hit, and `noResults` otherwise, so the status is exactly the
outcome.

The change is additive: the event name and `query` are unchanged, and
the `loading`, `error`, and `initial` states still don't fire the event.

Linear:
[GROWTH-1330](https://linear.app/supabase/issue/GROWTH-1330/docs-search-v2-add-hasresults-to-docs-search-v2-search-submitted)

## Review instructions

1. Open the docs preview with the Search V2 flag query:
`?docs-search-v2=search-v2-active`.
2. Open search and type a query that returns results. In the network
tab, the `/platform/telemetry/event` request for
`docs_search_v2_search_submitted` has `custom_properties` `{ "query":
"...", "hasResults": true }`.
3. Type a query that returns nothing (for example random characters).
The event has `"hasResults": false`.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] 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)
(not applicable: no docs content changed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JaqCdU2sPkBMbaUmUPW75i

---
_Generated by [Claude
Code](https://claude.ai/code/session_01JaqCdU2sPkBMbaUmUPW75i)_

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-13 10:41:53 -03:00
..
2026-07-01 12:59:00 +02:00
2026-10-02 12:33:25 -05:00

Reference Docs

Supabase Reference Docs

Maintainers

If you are a maintainer of any tools in the Supabase ecosystem, you can use this site to provide documentation for the tools & libraries that you maintain.

DocSpec

We use documentation specifications which can be used to generate human-readable docs.

  • OpenAPI: for documenting API endpoints.
  • SDKSpec (custom to Supabase): for SDKs and client libraries.
  • ConfigSpec (custom to Supabase): for configuration options.
  • CLISpec (custom to Supabase): for CLI commands and usage.

The benefit of using custom specifications is that we can generate many other types from a strict schema (eg, HTML and manpages). It also means that we can switch to any documentation system we want. On this site we use Next.js, but on Supabase's official website, we use a custom React site and expose only a subset of the available API for each tool.

Contributing

To contribute to docs, see the style guide for how to write a page, and the developers' guide and contributing guide for repo mechanics. If you write with an AI coding agent, use the /write-the-docs skill to draft and /edit-the-docs to revise an existing page.