The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Read the search namespace from one place
Rafic41ec8d0f450
diff --git a/apps/web/lib/api/partners/search/providers/turbopuffer.ts b/apps/web/lib/api/partners/search/providers/turbopuffer.tsindex 94d7dff026..d14f9bcc58 100644--- a/apps/web/lib/api/partners/search/providers/turbopuffer.ts+++ b/apps/web/lib/api/partners/search/providers/turbopuffer.ts@@ -20,7 +20,7 @@ import { getEmailNgrams, getQueryNgrams } from "./shared";* existing namespace. A new version is backfilled alongside the old one and* swapped in, rather than rebuilt in place.*/-const NAMESPACE = "partner-search-v3";+export const PARTNER_SEARCH_NAMESPACE = "partner-search-v3";const WRITE_BATCH_SIZE = 500;/**@@ -120,7 +120,7 @@ export interface TurbopufferNamespace {}function getNamespaceName(namespaceName?: string): string {- return namespaceName?.trim() || NAMESPACE;+ return namespaceName?.trim() || PARTNER_SEARCH_NAMESPACE;}function createNamespace(namespaceName: string): TurbopufferNamespace {diff --git a/apps/web/scripts/dev/debug-partner-search.ts b/apps/web/scripts/dev/debug-partner-search.tsindex 74962eec08..516f746101 100644--- a/apps/web/scripts/dev/debug-partner-search.ts+++ b/apps/web/scripts/dev/debug-partner-search.ts@@ -8,6 +8,7 @@ import {type PartnerSearchDocument,type PartnerSearchHit,} from "@/lib/api/partners/search";+import { PARTNER_SEARCH_NAMESPACE } from "@/lib/api/partners/search/providers/turbopuffer";import { prisma } from "@/lib/prisma";import { parsePositiveInteger } from "@/scripts/utils/parse-cli-number";import { ProgramEnrollmentStatus } from "@prisma/client";@@ -103,7 +104,6 @@ function containsLiteralQuery(: false;}-const NAMESPACE = "partner-search-v2";const EMAIL_PATTERN = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;/**@@ -123,7 +123,7 @@ async function fetchIndexedText(ids: string[]): Promise<Map<string, string>> {const namespace = new Turbopuffer({apiKey,region: "aws-us-east-1",- }).namespace(NAMESPACE);+ }).namespace(PARTNER_SEARCH_NAMESPACE);const { rows } = await namespace.query({rank_by: ["id", "asc"],top_k: ids.length,