Skip to content

Creator Discovery & Search — Relevance, Indexes, Safe Public DTOs (Hard) #52

Description

@aji70

Task: Creator Discovery & Search — Relevance, Indexes, Safe Public DTOs (Hard)

Overview

Discover needs a real search API. Ship indexed, ranked-ish discovery with filters, featured stub, strict public DTOs (no PII), and abuse-resistant pagination — not ILIKE %q% full scans without indexes/docs.


Scope (must all ship)

Endpoints

  • GET /api/v1/creators/search?q&category&page&limit&sort
  • GET /api/v1/creators/featured?limit — deterministic stub (recently onboarded / manual flag)
  • Public only; no auth required

Query behavior

  • Match handle prefix + displayName (document ranking: exact handle > prefix > displayName)
  • Category filter
  • Exclude non-onboarded / deleted users
  • sort: relevance | newest | popular (popular may stub via subscriberCount if available)
  • Empty q returns paginated onboarded catalog

Performance

  • Add DB indexes supporting prefix search (e.g. LOWER(handle) text_pattern_ops / trigram if extension OK — document choice)
  • Cap q length; sanitize %/_ wildcards
  • Limit max page size

DTO security

  • Public creator card: handle, displayName, bio excerpt, avatar, category, counts — never email/password/tokens

Testing (≥12)

  • Prefix handle match
  • Category filter
  • Non-onboarded excluded
  • Empty q pagination
  • Featured limit
  • Wildcard injection doesn’t explode results
  • PII absent from response (assert keys)
  • sort newest
  • Invalid category 400 or empty (document)

Deliverables

  • CreatorSearchService, indexes/migration, Swagger, docs/creator-search.md, ≥12 tests

Acceptance Criteria

  • Search + featured correct and PII-safe
  • Indexes/docs for scale
  • Standard pagination envelope
  • CI green

Out of scope

  • Elasticsearch/OpenSearch cluster
  • Personalized recommendations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions