Query Page Generation: From Search Data to SEO-Optimized Pages
This article explains how we automatically generate thousands of query pages from search data.
The Problem: Creating Pages for Every Search Query
Users search for products in many ways:
-
"mini pc for office"
-
"small computer 16gb ram"
-
"compact desktop windows 11"
Each query deserves a dedicated page with:
-
Matching products filtered by query intent
-
SEO-optimized content (title, description, meta tags)
-
Related searches to help users explore
-
Multilingual support for global users
Creating these pages manually is impossible at scale (65,000+ queries).
The Solution: Automated Query Page Generation
The SEO pipeline generates query pages automatically:
- Cluster similar queries (e.g., "mini pc" + "small computer")
- Extract filters from query text (e.g., "16gb ram" → RAM filter)
- Match products using semantic similarity
- Generate content with AI (DeepSeek)
- Create page at
/q/<slug>
Query Page Model
Query pages are stored in DynamoDB using the QueryPageV3 model. Each page has:
-
Slug: URL-friendly identifier (primary key)
-
Filters: Base filters for product matching
-
SKUs: Cached list of top 100 matching SKUs
-
Title: Page title for SEO
-
Descriptions: Multilingual content (tagline + body)
-
Metadata: Last updated timestamp, total score
Generation Process
Query pages are generated by the SEO pipeline:
- Cluster queries: Group similar queries using vector similarity
- Match products: Find products matching the query cluster
- Generate slug: Create URL-friendly identifier
- Cache SKUs: Store top 100 matching SKUs
- Generate content: AI-generated description
Content Generation
Query page content is generated using AI:
-
DeepSeek: Product descriptions, query page content
-
System prompts: For caching efficiency
-
Temperature: 0.7 for balanced creativity
The AI generates:
-
Tagline: Short, compelling headline
-
Body: Detailed product information
Multilingual Support
Query pages support multiple languages:
-
English (source)
-
Spanish, French, German, Italian, Portuguese
-
Russian, Hindi, Bengali, Gujarati, Kannada
-
Malayalam, Marathi, Punjabi, Tamil, Telugu
-
Arabic, Chinese, Japanese, Korean
Filter Extraction
Filters are extracted from search queries using phrase matching:
- Load phrase-to-filter mappings from JSON
- Match phrases in query using regex word boundaries
- Extract filter key-value pairs
- Store as base filters for the query page
Product Matching
Products are matched to query pages using:
- Vector similarity: Query embeddings vs product embeddings
- Filter matching: Extracted filters vs product attributes
- Product name matching: Fuzzy matching on product names
Caching Strategy
Query pages use multiple caching layers:
-
DynamoDB: Primary storage for query page data
-
Valkey: Cached SKUs for fast product loading
-
CloudFront: CDN caching for static content
Request Flow
flowchart TD
A[Client Request] --> B{Slug exists?}
B -->|Yes| C[Load QueryPageV3]
B -->|No| D[Search Products]
C --> E[Parse URL filters]
E --> F[Merge with base filters]
F --> G[Get cached SKUs]
G --> H[Load products]
H --> I[Render page]
D --> ISummary
Query page generation provides:
-
Dynamic pages: Auto-generated from search data
-
AI content: Automated content generation
-
Multilingual: Support for 15+ languages
-
Fast loading: Multiple caching layers
-
Smart filtering: Phrase-based filter extraction