Skip to content

feat: enhanced search filters - #2398

Merged
Philipinho merged 28 commits into
mainfrom
feat/search-filters
Aug 25, 2026
Merged

Philipinho merged 28 commits into
mainfrom
feat/search-filters

Conversation

@salihudickson

Copy link
Copy Markdown
Collaborator

@salihudickson salihudickson changed the title advanced search filters feat(ee): enhanced search filters Aug 15, 2026
@salihudickson
salihudickson requested a lite review from Copilot August 15, 2026 21:54
@salihudickson
salihudickson marked this pull request as draft August 15, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Enterprise search filtering capabilities by creator and labels, wiring the new filter parameters end-to-end from the client UI through to the server search query.

Changes:

  • Server: accept labelIds in search DTO and apply a label-based filter in the search query.
  • Client: add creator + label filter UI controls and include these parameters in page search requests.
  • Client: improve label query UX by keeping previous data during label searches.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/server/src/core/search/search.service.ts Adds label-based filtering to the page search query.
apps/server/src/core/search/dto/search.dto.ts Extends search DTO to accept labelIds array.
apps/client/src/features/search/types/search.types.ts Extends page search params type with creatorId and labelIds.
apps/client/src/features/search/components/search-spotlight.tsx Passes creator/label filters into search params; memoizes filter handler.
apps/client/src/features/search/components/search-spotlight-filters.tsx Adds Creator + Label filter controls and propagates filter state upward.
apps/client/src/features/search/components/label-filter-menu.tsx New multi-select label filter menu (checkbox-style).
apps/client/src/features/search/components/creator-filter-menu.tsx New creator picker menu backed by search suggestions.
apps/client/src/features/label/queries/label-query.ts Keeps previous data when fetching workspace labels (smoother UI).
apps/client/src/components/ui/checkbox-menu-item.tsx New checkbox-style menu item component for accessible checked state.
Suppressed comments (2)

apps/server/src/core/search/dto/search.dto.ts:31

  • labelIds is unbounded; large arrays can create huge IN (...) lists and expensive GROUP BY/HAVING work. Consider capping it (consistent with other DTOs that cap arrays) to reduce performance/DoS risk.
  @IsOptional()
  @IsArray()
  @IsUUID('all', { each: true })
  labelIds?: string[];

apps/server/src/core/search/dto/search.dto.ts:9

  • If you add @ArrayMaxSize(...) for labelIds (recommended to prevent very large filter arrays), it must also be imported from class-validator here; otherwise the DTO won't compile.

This issue also appears on line 28 of the same file.

import {
  IsArray,
  IsBoolean,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  IsUUID,
} from 'class-validator';

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 36 to 43
export function useWorkspaceLabelsQuery(query: string, enabled: boolean) {
return useQuery({
queryKey: WORKSPACE_LABELS_KEY(query),
queryFn: () => getWorkspaceLabels({ type: "page", query, limit: 50 }),
enabled,
staleTime: 30 * 1000,
placeholderData: keepPreviousData
});
Comment on lines +5 to +10
export const CheckboxMenuItem = forwardRef<
HTMLButtonElement,
ComponentPropsWithoutRef<"button">
>((props, ref) => (
<UnstyledButton ref={ref} {...props} role="menuitemcheckbox" />
));
@Philipinho Philipinho changed the title feat(ee): enhanced search filters feat: enhanced search filters Aug 15, 2026
@Philipinho

Copy link
Copy Markdown
Member

Thinking more about this, we have to handle such filters support for the Typesense integration as well.
That may mean indexing labels and users in Typesense too.

@salihudickson

Copy link
Copy Markdown
Collaborator Author

yeah. Currently I implemented a bit of a work-around, but indexing the labels will definitely make the searching quicker. CreatorId for pages is already indexed, so no problems there.

@Philipinho

Copy link
Copy Markdown
Member

Thanks for your work.

Let's work on a follow up PR to further extend the labels visibility.

We can extend this by introducing new endpoints for label tag cloud, and a UI for it.
The space labels would be exposed at /s/growth/labels to display all the labels in that space as a tag cloud.

It should be accessed from the space menu.
image

At the workspace level, we do same with a new route at /labels. This route diplays all labels across all spaces the user has access to.
Ideally, follows the existing permissions we used for labels search.

# Conflicts:
#	apps/client/src/features/search/components/search-spotlight.tsx
#	apps/server/src/ee
Created by and Labels now stay hidden until they hold a value; a Filter
button at the right end of the bar lists the hidden ones and opens the
picked filter's dropdown immediately.
Adds a titleOnly flag to page search: the Postgres driver matches
titles via trigram-indexed unaccented LIKE ranked by word_similarity,
and a Match filter in the search spotlight switches between everything
and title-only matching.
The titleOnly flag now matches attachment file names via the
separator-normalized trigram expression, and the toggle chip stays
available in attachment mode as File name only.
Selecting labels now lists their pages newest-first before any text is
typed, on both the Postgres and Typesense drivers.
@Philipinho
Philipinho marked this pull request as ready for review August 25, 2026 00:38
@Philipinho
Philipinho merged commit 917195b into main Aug 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants