mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
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>
This commit is contained in:
1 parent
24307c02e5
commit
ffef679f70
2 files changed
+5
-1
No files matched your search
@@ -82,7 +82,7 @@ function SearchV2Panel({ onResultSelect, onResultOpen }: SearchV2PanelProps) {
|
||||
if (searchState.status === 'results' || searchState.status === 'noResults') {
|
||||
sendTelemetryEvent({
|
||||
action: 'docs_search_v2_search_submitted',
|
||||
properties: { query: searchState.query },
|
||||
properties: { query: searchState.query, hasResults: searchState.status === 'results' },
|
||||
})
|
||||
}
|
||||
}, [searchState, sendTelemetryEvent])
|
||||
|
||||
@@ -1143,6 +1143,10 @@ export interface DocsSearchV2SearchSubmittedEvent {
|
||||
* The search term sent to the Search V2 endpoint.
|
||||
*/
|
||||
query: string
|
||||
/**
|
||||
* Whether the Search V2 endpoint returned at least one result for the query.
|
||||
*/
|
||||
hasResults: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user