Skip to content

: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.

feat(search): let product manifests declare search keywords (#111732)

Paul D'Ambrab56aab58e5f6
diff --git a/frontend/src/lib/components/Search/searchLogic.test.ts b/frontend/src/lib/components/Search/searchLogic.test.ts
index e1d01d9aaeaf..54afd265b81f 100644
--- a/frontend/src/lib/components/Search/searchLogic.test.ts
+++ b/frontend/src/lib/components/Search/searchLogic.test.ts
@@ -10,6 +10,7 @@ import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import { searchLogic } from './searchLogic'
+import { filterSearchItems } from './utils'
/** Poll until a condition holds. The searches settle in no fixed order, so an ordered
* `toDispatchActions` list would wait on an action that had already gone past. */
@@ -171,6 +172,15 @@ describe('searchLogic', () => {
expect(logic.values.personSearchResultsLoading).toBe(true)
})
+ it.each([
+ ['data quality', 'dataManagementItems', 'Models'],
+ ['batch exports', 'dataManagementItems', 'Destinations'],
+ ['insights', 'productsItems', 'Product analytics'],
+ ] as const)('finds an item by a manifest search keyword: %s', (search, selector, itemName) => {
+ const matches = filterSearchItems(logic.values[selector], search)
+ expect(matches.map((item) => item.name)).toContain(itemName)
+ })
+
it('maps matching support tickets into their own category', async () => {
useMocks({
get: {
diff --git a/frontend/src/lib/components/Search/searchLogic.tsx b/frontend/src/lib/components/Search/searchLogic.tsx
index 5640c1e3305e..0ff934d8522b 100644
--- a/frontend/src/lib/components/Search/searchLogic.tsx
+++ b/frontend/src/lib/components/Search/searchLogic.tsx
@@ -898,10 +898,6 @@ export const searchLogic = kea<searchLogicType>([
sceneLogViewsByRef: Record<string, string>
): SearchItem[] => {
const allProducts = getTreeItemsProducts()
- const productSearchKeywords: Record<string, string[]> = {
- 'Product analytics': ['insights'],
- Support: ['tickets'],
- }
const filteredProducts = allProducts.filter((product) => {
if (!product.href) {
return false
@@ -923,7 +919,7 @@ export const searchLogic = kea<searchLogicType>([
productCategory: product.category || null,
href: product.href || PLACEHOLDER_HREF,
itemType: product.iconType || product.type || null,
- searchKeywords: productSearchKeywords[product.path],
+ searchKeywords: product.searchKeywords,
lastViewedAt: product.sceneKey ? (sceneLogViewsByRef[product.sceneKey] ?? null) : null,
disabledReason: getProductAccessDisabledReason(product),
record: {
@@ -987,12 +983,6 @@ export const searchLogic = kea<searchLogicType>([
CDP: ['data pipelines', 'data pipeline', 'pipeline'],
}
- // Synonyms people search for that don't appear in the item name.
- const pathSearchKeywords: Record<string, string[]> = {
- Destinations: ['batch exports', 'export data'],
- Sources: ['data warehouse', 'warehouse', 'connectors', 'import data'],
- }
-
const items = filteredMetadata.map((item) => ({
id: `data-management-${item.path}`,
name: item.path,
@@ -1003,7 +993,7 @@ export const searchLogic = kea<searchLogicType>([
itemType: item.iconType || item.type || null,
searchKeywords: [
...(item.category ? (categorySearchKeywords[item.category] ?? []) : []),
- ...(pathSearchKeywords[item.path] ?? []),
+ ...(item.searchKeywords ?? []),
],
lastViewedAt: item.sceneKey ? (sceneLogViewsByRef[item.sceneKey] ?? null) : null,
disabledReason: getProductAccessDisabledReason(item),
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 153afb0e9c04..417e1af993e5 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -2656,6 +2656,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [
category: ProductItemCategory.ANALYTICS,
type: 'insight',
href: urls.insights(),
+ searchKeywords: ['insights'],
iconType: 'product_analytics',
iconColor: ['var(--color-product-product-analytics-light)'],
sceneKey: 'SavedInsights',
@@ -2773,6 +2774,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [
intents: [ProductKey.CONVERSATIONS],
category: ProductItemCategory.MONITORING,
href: urls.supportTickets(),
+ searchKeywords: ['tickets'],
type: 'conversations',
iconType: 'conversations',
iconColor: ['var(--color-product-support-light)', 'var(--color-product-support-dark)'] as FileSystemIconColor,
@@ -2958,6 +2960,7 @@ export const getTreeItemsMetadata = (): FileSystemImport[] => [
iconType: 'data_destination',
iconColor: ['var(--color-product-destinations-light)', 'var(--color-product-destinations-dark)'],
href: urls.destinations(),
+ searchKeywords: ['batch exports', 'export data'],
sceneKey: 'Destinations',
sceneKeys: ['Destinations'],
},
@@ -3028,6 +3031,7 @@ export const getTreeItemsMetadata = (): FileSystemImport[] => [
iconType: 'data_modeling',
iconColor: ['var(--color-product-models-light)', 'var(--color-product-models-dark)'],
href: urls.models(),
+ searchKeywords: ['data quality', 'lineage', 'materialized views'],
sceneKey: 'Models',
sceneKeys: ['Models'],
},
@@ -3076,6 +3080,7 @@ export const getTreeItemsMetadata = (): FileSystemImport[] => [
iconType: 'data_source',
iconColor: ['var(--color-product-sources-light)', 'var(--color-product-sources-dark)'],
href: urls.sources(),
+ searchKeywords: ['data warehouse', 'warehouse', 'connectors', 'import data'],
sceneKey: 'Sources',
sceneKeys: ['Sources'],
},
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index b99ae1e2143d..e3580f9240f8 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -27245,6 +27245,13 @@
},
"type": "array"
},
+ "searchKeywords": {
+ "description": "Other terms that find this item in search, for example the names of its tabs or common synonyms",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
"shortcut": {
"description": "Whether this is a shortcut or the actual item",
"type": "boolean"
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 8eb31f33b1ba..e356863fcb80 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -5526,6 +5526,8 @@ export interface FileSystemImport extends Omit<FileSystemEntry, 'id'> {
intents?: ProductKey[]
/** Display label override — when set, shown in the nav instead of the last segment of `path` */
displayLabel?: string
+ /** Other terms that find this item in search, for example the names of its tabs or common synonyms */
+ searchKeywords?: string[]
}
export interface FileSystemViewLogEntry {
diff --git a/posthog/schema.py b/posthog/schema.py
index 5ca6ede20b1d..25cde11a3ed2 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -5573,6 +5573,10 @@ class FileSystemImport(BaseModel):
description="Match this with the a base scene key or a specific one",
)
sceneKeys: list[str] | None = Field(default=None, description="List of all scenes exported by the app")
+ searchKeywords: list[str] | None = Field(
+ default=None,
+ description=("Other terms that find this item in search, for example the names of its tabs or common synonyms"),
+ )
shortcut: bool | None = Field(default=None, description="Whether this is a shortcut or the actual item")
tags: list[Tag] | None = Field(default=None, description="Tag for the product 'beta' / 'alpha'")
type: str | None = Field(
diff --git a/products/cdp/manifest.tsx b/products/cdp/manifest.tsx
index dbff53688530..6f6ecf0764a2 100644
--- a/products/cdp/manifest.tsx
+++ b/products/cdp/manifest.tsx
@@ -102,6 +102,7 @@ export const manifest: ProductManifest = {
iconType: 'data_destination',
iconColor: ['var(--color-product-destinations-light)', 'var(--color-product-destinations-dark)'],
href: urls.destinations(),
+ searchKeywords: ['batch exports', 'export data'],
sceneKey: 'Destinations',
sceneKeys: ['Destinations'],
},
diff --git a/products/conversations/manifest.tsx b/products/conversations/manifest.tsx
index a043fc15c4c7..a10dca7b8aa3 100644
--- a/products/conversations/manifest.tsx
+++ b/products/conversations/manifest.tsx
@@ -63,6 +63,7 @@ export const manifest: ProductManifest = {
intents: [ProductKey.CONVERSATIONS],
category: ProductItemCategory.MONITORING,
href: urls.supportTickets(),
+ searchKeywords: ['tickets'],
type: 'conversations',
iconType: 'conversations',
iconColor: [
diff --git a/products/data_modeling/manifest.tsx b/products/data_modeling/manifest.tsx
index 82a9ae70bc55..86d4aab8a027 100644
--- a/products/data_modeling/manifest.tsx
+++ b/products/data_modeling/manifest.tsx
@@ -38,6 +38,7 @@ export const manifest: ProductManifest = {
iconType: 'data_modeling',
iconColor: ['var(--color-product-models-light)', 'var(--color-product-models-dark)'],
href: urls.models(),
+ searchKeywords: ['data quality', 'lineage', 'materialized views'],
sceneKey: 'Models',
sceneKeys: ['Models'],
},
diff --git a/products/data_warehouse/manifest.tsx b/products/data_warehouse/manifest.tsx
index 09ff13c9c0b5..854b06f45be8 100644
--- a/products/data_warehouse/manifest.tsx
+++ b/products/data_warehouse/manifest.tsx
@@ -194,6 +194,7 @@ export const manifest: ProductManifest = {
iconType: 'data_source',
iconColor: ['var(--color-product-sources-light)', 'var(--color-product-sources-dark)'],
href: urls.sources(),
+ searchKeywords: ['data warehouse', 'warehouse', 'connectors', 'import data'],
sceneKey: 'Sources',
sceneKeys: ['Sources'],
},
diff --git a/products/product_analytics/manifest.tsx b/products/product_analytics/manifest.tsx
index f142e981bee8..18cae8b460ff 100644
--- a/products/product_analytics/manifest.tsx
+++ b/products/product_analytics/manifest.tsx
@@ -182,6 +182,7 @@ export const manifest: ProductManifest = {
category: ProductItemCategory.ANALYTICS,
type: 'insight',
href: urls.insights(),
+ searchKeywords: ['insights'],
iconType: 'product_analytics',
iconColor: ['var(--color-product-product-analytics-light)'],
sceneKey: 'SavedInsights',