:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-warehouse): find database sources when searching "warehouse" (#108092)
Tom Owersd84cd8627456
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.tsindex cd9ff96a8222..c1a1bf5e4142 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts@@ -55,6 +55,11 @@ const MANUAL_SOURCE_KEYWORDS: Record<string, string[]> = {azure: ['azure', 'microsoft azure', 'azure blob', 'blob storage'],}+// The catalog matches a source against its label, name, keywords and category. That finds the+// Databases category for "database", but "warehouse" matches nothing at all, even though it is+// the word in this product's own name. Attach the words people type for the category itself.+const DATABASE_CATEGORY_KEYWORDS = ['warehouse', 'data warehouse', 'dwh']+// Every self-managed connector links files from a bucket, so a user searching for a file// format ("csv", "parquet") should land on them rather than an empty result that pushes// them to request a source we already support. Matches the formats the link form accepts.@@ -324,7 +329,10 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([existingSource: connectedTypes.has(connector.name) || undefined,name: connector.name,label: connector.label ?? connector.name,- keywords: connector.keywords ?? [],+ keywords:+ connector.category === DataWarehouseSourceCategoryApi.Databases+ ? [...(connector.keywords ?? []), ...DATABASE_CATEGORY_KEYWORDS]+ : (connector.keywords ?? []),featured: connector.featured ?? undefined,url: urls.dataWarehouseSourceNew(connector.name),},diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.tsindex de2101735313..5ce7d22f4a8b 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts@@ -29,6 +29,14 @@ const AVAILABLE_SOURCES: Record<string, SourceConfigResponseApi> = {// Connectable, and shares the "apple" token with the unreleased `Apple` above so a search for// "apple" fuzzy-matches both — used to assert connectable results outrank "Coming soon" ones.ApplePay: { name: 'ApplePay', label: 'Apple Pay', fields: [] } as unknown as SourceConfigResponseApi,+ // A Databases-category source, so a search for the words people use for the category itself+ // has something to find.+ Postgres: {+ name: 'Postgres',+ label: 'Postgres',+ category: 'Databases',+ fields: [],+ } as unknown as SourceConfigResponseApi,// Two sources in distinct categories, used to assert that a category-filtered search which only// matches a source in another category flags a cross-category hint instead of dead-ending.Salesforce: {@@ -159,6 +167,15 @@ describe('sourceCatalogLogic', () => {expect(names.indexOf('google-cloud')).toBeLessThan(names.indexOf('aws'))})+ // "database" already found these through the category name. The word in the product's own+ // name found nothing at all, which sent the user to "request a source".+ it.each(['warehouse', 'dwh'])('finds database sources when searching "%s"', (search) => {+ const logic = sourceCatalogLogic()+ logic.actions.setSearch(search)++ expect(logic.values.filteredItems.map((item) => item.name)).toContain('Postgres')+ })+it('flags a cross-category match when a filtered search only hits another category', () => {const logic = sourceCatalogLogic()logic.actions.setSelectedCategory('Sales')