fix(BUY-7836): expand category search to include category_path subcategories#31
Open
fix(BUY-7836): expand category search to include category_path subcategories#31
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/searchnow ORs anEXISTS (unnest(category_path))check alongside the existingcategory ILIKEmatchProblem
Atlas coverage analysis (BUY-7437) was missing products from Watsons/Guardian SG because gap category queries (e.g. "Eye Care") matched only
categorycolumn, not thecategory_patharray where those products are actually classified.Changes
app/routers/search.py— 3 category filter sites expanded with OR + unnest EXISTS clausetests/api/test_api_endpoints.py(new) — 2 tests verifying the unnest clause structure for Hair Care and Toothbrush subcategory patternsTest plan
pytest tests/api/test_api_endpoints.py -v— 2 passed?category=Eye+Careon staging, verify Watsons eye cream products appearCloses BUY-7836
🤖 Generated with Claude Code