Skip to content

[BE-27] Implement global search endpoint across assets, users, and documents #1086

Description

@yusuftomilola

Overview

The frontend command palette (frontend/components/ui/command-palette.tsx) and a planned global search page ([FE-19]) need one endpoint that searches across the platform. A global search page existed before the reset commit.

What to Build

A SearchModule in backend/src/search/:

Method Path Description
GET /api/search?q=&types=&limit= Cross-entity search
  • Searches: assets (name, assetId, serialNumber, manufacturer, model, tags), users (name, email), documents (name) — types filter narrows scope
  • Postgres ILIKE for v1 is fine; structure the service so full-text (tsvector) can replace it later
  • Grouped response: { assets: [...], users: [...], documents: [...] }, each item with id, display label, and route hint (e.g. /assets/:id)
  • Respect RBAC ([BE-15]): staff results limited to what they can view
  • Min query length 2; limit per group (default 5, max 20)

References

  • Pre-reset version: git log --oneline --all -- 'backend/src/**search**' / commit 0c2b80b
  • Blocked by [BE-06], [BE-03], [BE-10]

Acceptance Criteria

  • One request returns grouped, ranked matches across all three types
  • types=assets narrows correctly; per-group limit respected
  • Query under 2 chars returns 400
  • Response includes enough data for the command palette to render and navigate

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions