Prompt
How do I rank search results with recommendation signals?
Latest observation
A good way to rank search results with recommendation signals is to treat it as a learning-to-rank / hybrid ranking problem:
1) Start with a search relevance score
Your search system should produce a base score from text relevance signals like:
- BM25 / lexical match
- semantic embeddings / vector similarity
- query-document field matches
- freshness / popularity / quality
This gives you a solid “search intent” ranking.
2) Add recommendation signals as re-ranking features
Recommendation signals are often best used after retrieval, as features in a second-stage ranker. Examples:
- user-item affinity
- collaborative filtering score
- “users like you clicked this”
- historical dwell time / conversion probability
- item popularity within user segment
- freshness or novelty relative to the user’s behavior
- personalization based on past interactions
These signals should augment search relevance, not replace it.
3) Combine them with a ranking model
Common approaches:
Simple weighted scoring
A first baseline: [ score = \alpha \cdot search_score + \beta \cdot rec_score + \gamma \cdot other_features ] Useful when you need something easy to debug.
Learning-to-rank model
Train a model like:
- LambdaMART / XGBoost ranking
- neural ranking model
Input features can include:
- search relevance
- recency
- user affinity
- CTR priors
- query-item category match
- personalization features
Train on clicks, saves, purchases, or dwell time.
4) Handle the tradeoff between relevance and personalization
Search users usually expect results that match the query, so don’t over-personalize. A good pattern is:
- enforce a relevance threshold
- re-rank only the top N relevant candidates
- use recommendation signals to break ties or fine-tune ordering
For example:
- “apple watch band” should still return watch bands, not random items a user likes.
- Recommendation signals can decide which band is shown first.
5) Use intent-aware blending
Different query types need different weighting:
- Navigational queries: mostly search relevance
- Exploratory queries: more room for rec/personalization
- Ambiguous queries: recommendation signals can help disambiguate
- Repeat purchase / habitual queries: rec signals can be stronger
You can infer query intent from:
- query length
- category specificity
- historical click patterns
- user session context
6) Guard against bias and feedback loops
Recommendation signals can amplify popularity bias. Watch for:
- rich-get-richer effects
- reduced diversity
- filter bubbles
- overfitting to historical clicks
Mitigations:
- diversity constraints
- freshness boosts
- exploration traffic
- de-bias click data with counterfactual methods
- separate long-term value from short-term CTR
7) Evaluate with both search and rec metrics
Offline:
- NDCG@k, MAP, MRR for ranking quality
- CTR, conversion, dwell time
- coverage, diversity, novelty
Online:
- click-through rate
- add-to-cart / purchase rate
- reformulation rate
- long-click rate
- revenue or retention if relevant
8) A practical architecture
- Retrieve top 1000 by search relevance
- Filter to top 100 by hard constraints
- Re-rank using a model with both search and recommendation features
- Apply business rules:
- deduplicate
- diversify
- freshness caps
- safety or policy filters
9) Good starting formula
If you want a simple production baseline:
[ final_score = 0.7 \cdot search_relevance + 0.2 \cdot user_affinity + 0.1 \cdot popularity_or_freshness ]
Then tune weights by query type and validate with A/B tests.
If you want, I can also show:
- a concrete ranking formula
- an ML feature set
- or a Python example for hybrid search + recommendation ranking.
Brands