Skip to content

Commit 264ae43

Browse files
authored
feat: add organization search to global search pipe (IN-1206) (#4368)
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent 9f4ac47 commit 264ae43

2 files changed

Lines changed: 48 additions & 5 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
DESCRIPTION >
2+
Provides filters for organizations
3+
4+
NODE organizations_filtered_0
5+
SQL >
6+
%
7+
SELECT
8+
organizations_populated_slug.id AS id,
9+
organizations_populated_slug.displayName AS displayName,
10+
organizations_populated_slug.logo AS logo,
11+
organizations_populated_slug.slug AS slug,
12+
organizations_populated_slug.contributionCount AS contributionCount
13+
FROM organizations_populated_slug
14+
where
15+
1 = 1
16+
{% if defined(slug) %}
17+
AND organizations_populated_slug.slug
18+
= {{ String(slug, description="Filter organization by slug", required=False) }}
19+
{% end %}
20+
{% if defined(search) %}
21+
AND organizations_populated_slug.displayName
22+
ilike '%'
23+
|| {{
24+
String(
25+
search,
26+
description="Search organization open ended wildcard using displayName",
27+
required=False,
28+
)
29+
}}
30+
|| '%'
31+
{% end %}

services/libs/tinybird/pipes/search_collections_projects_repos.pipe

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
DESCRIPTION >
2-
- `search_collections_projects_repos.pipe` serves the unified search widget for collections, projects, and repositories.
3-
- Performs search across three entity types using shared `search` parameter and returns up to configurable results per type.
4-
- Combines results from `collections_filtered`, `insightsProjects_filtered`, and `activityRepositories_filtered` pipes.
2+
- `search_collections_projects_repos.pipe` serves the unified search widget for collections, projects, repositories, and organizations.
3+
- Performs search across four entity types using shared `search` parameter and returns up to configurable results per type.
4+
- Combines results from `collections_filtered`, `insightsProjects_filtered`, `activityRepositories_filtered`, and `organizations_filtered` pipes.
55
- Filters out inactive projects (with 0 organizations and 0 contributors) to ensure relevant search results.
6-
- Orders results by relevance: collections by project count, projects by contributor count, repositories alphabetically.
6+
- Orders results by relevance: collections by project count, projects by contributor count, repositories alphabetically, organizations by contribution count.
77
- Primary use case: powering global search functionality and autocomplete dropdowns across the platform.
88
- Parameters:
99
- `search`: Required string for searching across all entity types (inherited by filtered pipes)
1010
- `limit`: Optional integer for result limit per entity type, defaults to 10
11-
- Response: `type` ('collection'|'project'|'repository'), `id` (projectId only), `slug`, `logo`, `projectSlug`, `name`
11+
- Response: `type` ('collection'|'project'|'repository'|'organization'), `id` (projectId only), `slug`, `logo`, `projectSlug`, `name`
1212

1313
NODE merge_results_from_collections_projects_repos_filtered
1414
SQL >
@@ -53,3 +53,15 @@ SQL >
5353
from activityRepositories_filtered
5454
order by activityRepositories_filtered.repo asc
5555
limit {{ Integer(limit, 10, description="Limit number of records for each type", required=False) }}
56+
union all
57+
select
58+
'organization' as type,
59+
organizations_filtered.id,
60+
organizations_filtered.slug,
61+
organizations_filtered.logo,
62+
null as "projectSlug",
63+
organizations_filtered.displayName as name,
64+
'' as status
65+
from organizations_filtered
66+
order by organizations_filtered.contributionCount desc
67+
limit {{ Integer(limit, 10, description="Limit number of records for each type", required=False) }}

0 commit comments

Comments
 (0)