Repository navigation
feat: enhanced search filters - #2398
Conversation
There was a problem hiding this comment.
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
labelIdsin 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
labelIdsis unbounded; large arrays can create hugeIN (...)lists and expensiveGROUP BY/HAVINGwork. 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(...)forlabelIds(recommended to prevent very large filter arrays), it must also be imported fromclass-validatorhere; 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.
| 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 | ||
| }); |
| export const CheckboxMenuItem = forwardRef< | ||
| HTMLButtonElement, | ||
| ComponentPropsWithoutRef<"button"> | ||
| >((props, ref) => ( | ||
| <UnstyledButton ref={ref} {...props} role="menuitemcheckbox" /> | ||
| )); |
|
Thinking more about this, we have to handle such filters support for the Typesense integration as well. |
|
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. |
# 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.
Selecting a creator with an empty query now lists their pages (or attachments in attachment mode) newest-first, with the same space and page permission filtering as typed search.

closes: https://github.com/docmost/issue-tracker/issues/3