Skip to content

feat(vton): posts hybrid search (artist/scene/title/context)#613

Merged
thxforall merged 1 commit into
devfrom
feat/602-vton-posts-hybrid-search
May 28, 2026
Merged

feat(vton): posts hybrid search (artist/scene/title/context)#613
thxforall merged 1 commit into
devfrom
feat/602-vton-posts-hybrid-search

Conversation

@thxforall
Copy link
Copy Markdown
Contributor

Summary

PR-4 of Epic #602 — VTON Modal 4-in-1. Adds hybrid search to the Posts tab so users can find a try-on-ready post by artist, scene/context, title, or group name.

  • /api/v1/vton/posts: new q query param.
    • Meilisearch-first: post hits returned by /api/v1/search narrow the Supabase query via in("id", …). Cheap and consistent with the existing items route.
    • If Meilisearch is unavailable → DB ilike OR fallback across title, artist_name, group_name, context.
    • Commas/parens in q are sanitized before being interpolated into the or() filter (PostgREST injection guard).
    • If Meilisearch responds with zero post-type hits, we trust the empty result and skip the wide DB fallback (avoids a misleading "ilike anything" fanout).
  • useVtonPostFetch: accepts searchQuery, debounced 300 ms, sent as q in the request URL.
  • VtonItemPanel: search input now visible in posts mode too; placeholder = Search posts by artist or scene.... Empty-state copy switches between "No posts match your search." and the existing "No try-on ready posts yet."
  • VtonModal: the existing searchQuery state is piped into useVtonPostFetch only when sourceMode === "posts" — no new state, existing reset-on-mode-switch behavior is preserved.

Stacking

This PR is stacked on top of #609 (feat/602-vton-expand-categories-and-search). Once #609 merges, GitHub will retarget this PR to dev.

Test plan

  • bun run vitest --run app/api/v1/vton lib/components/vton — 4 files / 30 tests pass (includes new q/hybrid cases in posts/__tests__/route.test.ts)
  • bun run tsc --noEmit — only the pre-existing scripts/content-studio-video-local.ts error (fix(content-studio): useResearchInCopy type mismatch in plan route test (from #498) #610), nothing vton-related
  • Manual: open VTON modal → Posts tab → type "blackpink" → debounced fetch narrows posts list; clear query → list resets
  • Manual: kill Meilisearch (or set API_BASE_URL empty) → search still works via DB ilike fallback

Scope / non-goals

  • Category filter on Posts tab: out of scope (search-only, per epic decision)
  • Cross-category empty-result hints: backlog
  • Meilisearch keywords indexing: backlog (touches ai-server / api-server)

Refs #602.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
decoded-app Error Error May 28, 2026 11:26am

@thxforall thxforall moved this from Todo to In Progress in decoded-monorepo May 28, 2026
@thxforall thxforall added the bump:minor Backward-compatible additions label May 28, 2026
@thxforall thxforall changed the base branch from feat/602-vton-expand-categories-and-search to dev May 28, 2026 11:22
- /api/v1/vton/posts: add `q` param. Meilisearch-first narrows posts by
  returned post-ids; if Meilisearch is unavailable, fall back to a DB
  ilike OR across title/artist_name/group_name/context. Commas/parens in
  q are sanitized before being interpolated into the or() filter.
- useVtonPostFetch: accept searchQuery, debounce 300ms, send q via URL.
- VtonItemPanel: render search input in posts mode too, with a
  posts-specific placeholder; differentiate empty-state copy for active
  search vs no data.
- VtonModal: pipe the existing searchQuery into useVtonPostFetch only
  while sourceMode === "posts".

Refs #602.
@thxforall thxforall force-pushed the feat/602-vton-posts-hybrid-search branch from e6b7b0c to 2ebdad6 Compare May 28, 2026 11:23
@thxforall thxforall merged commit c1e568d into dev May 28, 2026
3 of 4 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in decoded-monorepo May 28, 2026
@thxforall thxforall deleted the feat/602-vton-posts-hybrid-search branch May 28, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump:minor Backward-compatible additions

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant