fix(BUY-62409): boost laptop relevance 2x, demote accessories in FTS ranking#222
Open
BuyWhere wants to merge 6 commits into
Open
fix(BUY-62409): boost laptop relevance 2x, demote accessories in FTS ranking#222BuyWhere wants to merge 6 commits into
BuyWhere wants to merge 6 commits into
Conversation
…llowlist (BUY-60606)
…not touched - Add inferCountryFromQuery() function to detect 'singapore'/'sg' → 'sg' and 'us'/'usa'/'united states'/'america' → 'us' - Add countryTouched flag to track if user manually changed country dropdown - Only use query inference when country selector was never touched; otherwise respect user's manual selection - Fixes issue where 'laptop singapore' was defaulting to US instead of inferring Singapore market # Conflicts: # src/components/HomeProductSearch.tsx
…(BUY-59843) - priceRefresh now sets products.updated_at = NOW() so /v1/products/search returns fresh timestamps after the nightly pulse - New scraper_scheduler.py daemon runs existing scrapers on schedule, pushing data through the ingest API which sets updated_at = NOW() - Deploy docs and systemd unit files for the scraper scheduler
… is unavailable - getSeoLandingProducts returns [] instead of fallbackProducts on API failure - SeoLandingPage conditionally renders product grid and comparison table only when live data is available - Hero badge 'Live BuyWhere search results' hidden when no live products - Graceful search CTA shown when catalog snapshot cannot be populated - Removed fallbackProducts field from SeoLandingPageConfig and all page configs Fixes BUY-62408
- Add isPlaceholderProduct() to detect generic Product A/Brand A patterns - Add buildComparisonFromProducts() to build table from real API data - getSeoLandingProducts() returns [] on failure instead of fallbackProducts - Remove fallbackProducts config entries - SeoLandingPage: gate product grid, comparison table, and 'Live' badge on real product counts - Graceful search CTA fallback when no live products available
… sleeves/cases/bags/stands
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.
Problem
QA re-verification of BUY-62409 (2026-07-14T18:13Z) confirmed country inference works correctly (
country=sg), but search results for 'laptop singapore' are still broken: top 20 results are 100% laptop accessories (Targus Slipskin sleeves, Nano Lock cable locks, Spigen laptop bags, etc.) — zero actual laptop computers.Root Cause
PostgreSQL's
ts_rank()text search ranks products purely by text similarity. For queries containing 'laptop', accessories like 'Laptop Sleeve', 'Laptop Stand', 'Laptop Case', 'Laptop Bag', 'Laptop Cooling Pad', 'Laptop Charger' etc. score as highly relevant because they mention 'laptop' in their title. The search has no semantic understanding that 'laptop' as a standalone device is different from 'laptop accessory'.Fix
Applied a 2x relevance boost to products whose titles contain 'laptop' but do NOT contain accessory keywords:
This demotes laptop accessories relative to actual laptop computers in the FTS ranking, on both query paths (small result set <1000 rows and large result sets with candidate LIMIT).
Changes
api/src/routes/products.ts: Modified ORDER BY for both FTS ranking paths to multiplyts_rankby the CASE expression