From 98f89e6c0b0b0de9d75701d8e739b660606fb85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Grom?= Date: Tue, 21 Jul 2026 10:43:50 +0100 Subject: [PATCH] feat: filter org search to code contributors only (IN-1206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global search org results come from organizations_populated_slug, whose contributionCount counts all activities (countState(activityId)), not just code contributions. As a result ~62% of searchable orgs had activity but zero code contributions and linked to an empty organization dashboard, which only renders isCodeContribution activity types. Orgs deleted in CDP also linger as stale rows in Tinybird. Restrict organizations_filtered to orgs present in org_page_activities_timeseries_copy_ds (already scoped to isCodeContribution activity types over a 10-year window), matching what the org page shows. This sub-pipe is consumed only by the search pipe, so org pages and leaderboards are unaffected. Searchable orgs drop from 519k to 199k; stale high-activity orgs with no code contributions no longer appear. Signed-off-by: Gašper Grom --- .../tinybird/pipes/organizations_filtered.pipe | 18 +++++++++++++++++- .../search_collections_projects_repos.pipe | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/services/libs/tinybird/pipes/organizations_filtered.pipe b/services/libs/tinybird/pipes/organizations_filtered.pipe index b00e86a3fa..4728a3425b 100644 --- a/services/libs/tinybird/pipes/organizations_filtered.pipe +++ b/services/libs/tinybird/pipes/organizations_filtered.pipe @@ -1,5 +1,19 @@ DESCRIPTION > - Provides filters for organizations + Provides filters for organizations. + Only returns organizations that have at least one code contribution (commits, PRs, code + reviews), matching what the organization page dashboard actually renders. Organizations + with only non-code activity — or that were deleted in CDP but are still stale in Tinybird — + are excluded so search never links to an empty org dashboard. + +NODE organizations_code_contributors +DESCRIPTION > + Distinct organizations that have at least one code contribution activity, sourced from the + precomputed org-page timeseries (already filtered to isCodeContribution activity types). + +SQL > + SELECT DISTINCT organizationId + FROM org_page_activities_timeseries_copy_ds + WHERE organizationId != '' NODE organizations_filtered_0 SQL > @@ -11,6 +25,8 @@ SQL > organizations_populated_slug.slug AS slug, organizations_populated_slug.contributionCount AS contributionCount FROM organizations_populated_slug + INNER JOIN organizations_code_contributors + ON organizations_populated_slug.id = organizations_code_contributors.organizationId where 1 = 1 {% if defined(slug) %} diff --git a/services/libs/tinybird/pipes/search_collections_projects_repos.pipe b/services/libs/tinybird/pipes/search_collections_projects_repos.pipe index eeacb3085c..de319c49f3 100644 --- a/services/libs/tinybird/pipes/search_collections_projects_repos.pipe +++ b/services/libs/tinybird/pipes/search_collections_projects_repos.pipe @@ -3,6 +3,7 @@ DESCRIPTION > - Performs search across four entity types using shared `search` parameter and returns up to configurable results per type. - Combines results from `collections_filtered`, `insightsProjects_filtered`, `activityRepositories_filtered`, and `organizations_filtered` pipes. - Filters out inactive projects (with 0 organizations and 0 contributors) to ensure relevant search results. + - Filters out organizations with no code contributions (via `organizations_filtered`) so search never links to an empty org dashboard. - Orders results by relevance: collections by project count, projects by contributor count, repositories alphabetically, organizations by contribution count. - Primary use case: powering global search functionality and autocomplete dropdowns across the platform. - Parameters: