Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions services/libs/tinybird/pipes/organizations_filtered.pipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DESCRIPTION >
Provides filters for organizations

NODE organizations_filtered_0
SQL >
%
SELECT
organizations_populated_slug.id AS id,
organizations_populated_slug.displayName AS displayName,
organizations_populated_slug.logo AS logo,
organizations_populated_slug.slug AS slug,
organizations_populated_slug.contributionCount AS contributionCount
FROM organizations_populated_slug
where
1 = 1
{% if defined(slug) %}
AND organizations_populated_slug.slug
= {{ String(slug, description="Filter organization by slug", required=False) }}
{% end %}
{% if defined(search) %}
AND organizations_populated_slug.displayName
ilike '%'
|| {{
String(
search,
description="Search organization open ended wildcard using displayName",
required=False,
)
}}
|| '%'
{% end %}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
DESCRIPTION >
- `search_collections_projects_repos.pipe` serves the unified search widget for collections, projects, and repositories.
- Performs search across three entity types using shared `search` parameter and returns up to configurable results per type.
- Combines results from `collections_filtered`, `insightsProjects_filtered`, and `activityRepositories_filtered` pipes.
- `search_collections_projects_repos.pipe` serves the unified search widget for collections, projects, repositories, and organizations.
- 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.
- Orders results by relevance: collections by project count, projects by contributor count, repositories alphabetically.
- 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:
- `search`: Required string for searching across all entity types (inherited by filtered pipes)
- `limit`: Optional integer for result limit per entity type, defaults to 10
- Response: `type` ('collection'|'project'|'repository'), `id` (projectId only), `slug`, `logo`, `projectSlug`, `name`
- Response: `type` ('collection'|'project'|'repository'|'organization'), `id` (projectId only), `slug`, `logo`, `projectSlug`, `name`

NODE merge_results_from_collections_projects_repos_filtered
SQL >
Expand Down Expand Up @@ -53,3 +53,15 @@ SQL >
from activityRepositories_filtered
order by activityRepositories_filtered.repo asc
limit {{ Integer(limit, 10, description="Limit number of records for each type", required=False) }}
union all
select
'organization' as type,
organizations_filtered.id,
organizations_filtered.slug,
organizations_filtered.logo,
null as "projectSlug",
organizations_filtered.displayName as name,
'' as status
from organizations_filtered
order by organizations_filtered.contributionCount desc
limit {{ Integer(limit, 10, description="Limit number of records for each type", required=False) }}
Loading