fix(BUY-65156): demote backpack/accessory titles from FTS laptop boost - #261
Open
BuyWhere wants to merge 4 commits into
Open
fix(BUY-65156): demote backpack/accessory titles from FTS laptop boost#261BuyWhere wants to merge 4 commits into
BuyWhere wants to merge 4 commits into
Conversation
added 4 commits
July 15, 2026 14:24
QA flagged 'gaming laptop' returning a CARBONADO Backpack as the #1 result. The product title literally contains 'Gaming Laptop' and 'Laptop', so the existing BUY-62409 laptop-multiplier (2.0x on title LIKE '%laptop%' for the top_ids FTS CTE) was firing on backpack SKUs. The accessory exclusion list in that branch already covered sleeve/case/bag/stand/pad/cooler/adapter/ dock/hub/lock/briefcase/charger/table but not backpack/accessory keywords, so the backpack was outranking actual gaming laptops. This change extends the FTS ranking top_ids CTE to also negate backpack, accessories, replacement, battery, mouse, keyboard, headset, monitor, etc. from the laptop-boost branch. A backpack titled 'Gaming Backpack For Laptop, Gaming Laptop and Gaming Accessories' will no longer match the 2.0x boost and will rank behind actual gaming-laptop SKUs (RTX-series notebooks, ASUS ROG, Lenovo Legion, GIGABYTE A16). Also includes the BUY-63505 accessory-demotion refactor that hoists the shared accessoryDemotionSql expression so SEO/laptop/general fallback queries all use the same demotion terms, plus a new regression-guard test (BUY-65156) in tests/ts-rank-guard.test.mjs.
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
QA flagged 'gaming laptop' returning a CARBONADO Backpack as the #1 result. The product title literally contains 'Gaming Laptop' and 'Laptop', so the existing BUY-62409 laptop-multiplier (2.0x on title LIKE '%laptop%' for the top_ids FTS CTE) was firing on backpack SKUs. The accessory exclusion list in that branch already covered sleeve/case/bag/stand/pad/cooler/adapter/dock/hub/lock/briefcase/charger/table but not backpack/accessory keywords, so the backpack was outranking actual gaming laptops.
Fix
Extends the FTS ranking top_ids CTE in api/src/routes/products.ts to also negate backpack, accessories, replacement, battery, mouse, keyboard, headset, monitor, etc. from the laptop-boost branch. A backpack titled 'Gaming Backpack For Laptop, Gaming Laptop and Gaming Accessories' will no longer match the 2.0x boost and will rank behind actual gaming-laptop SKUs (RTX-series notebooks, ASUS ROG, Lenovo Legion, GIGABYTE A16).
Also includes the BUY-63505 accessory-demotion refactor that hoists the shared accessoryDemotionSql expression so SEO/laptop/general fallback queries all use the same demotion terms.
Tests
Files
🤖 Generated with Claude Code