Skip to content

fix(BUY-7836): expand category search to include category_path subcategories#31

Open
BuyWhere wants to merge 2 commits intoreleasefrom
atlas/BUY-7836-subcategory-search
Open

fix(BUY-7836): expand category search to include category_path subcategories#31
BuyWhere wants to merge 2 commits intoreleasefrom
atlas/BUY-7836-subcategory-search

Conversation

@BuyWhere
Copy link
Copy Markdown
Owner

@BuyWhere BuyWhere commented May 3, 2026

Summary

  • Category filter in /search now ORs an EXISTS (unnest(category_path)) check alongside the existing category ILIKE match
  • Applied in 3 places: main search query, count subquery, and facet query for consistency
  • Products with granular subcategory names (e.g. "Eye Creams, Gel & Serums") now surface when querying parent terms (e.g. "Eye Care")

Problem

Atlas coverage analysis (BUY-7437) was missing products from Watsons/Guardian SG because gap category queries (e.g. "Eye Care") matched only category column, not the category_path array where those products are actually classified.

Changes

  • app/routers/search.py — 3 category filter sites expanded with OR + unnest EXISTS clause
  • tests/api/test_api_endpoints.py (new) — 2 tests verifying the unnest clause structure for Hair Care and Toothbrush subcategory patterns

Test plan

  • pytest tests/api/test_api_endpoints.py -v — 2 passed
  • Manual: query ?category=Eye+Care on staging, verify Watsons eye cream products appear

Closes BUY-7836

🤖 Generated with Claude Code

Rex and others added 2 commits May 2, 2026 09:24
…ind_matches async

products.py calls ProductMatcher(db) and await matcher.find_matches(product, ...)
but the stub had no __init__ and find_matches was sync — causing TypeError 500.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
…egories

Products from Watsons/Guardian SG are classified under granular subcategory
names in category_path (e.g. "Eye Creams, Gel & Serums") that don't match
parent category names (e.g. "Eye Care") used in coverage gap queries.

Expand the category filter in three places (main query, count subquery,
facet query) to OR with an EXISTS/unnest check over category_path so
subcategory-classified products surface when querying parent category terms.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
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.

1 participant