Designing an Experiment to Measure Search Quality
Statistics & ExperimentsModel answerLast updated
Design an A/B test for a search feature change, define metrics to track button performance, and explain how to assess result quality.
You're working on a product with a search feature. Your team is considering changes to improve the search experience.
Part 1: Walk through how you would set up and execute an A/B test to evaluate a change to the search interface.
Part 2: If you're testing a new search button placement, what metrics would you track to understand its impact?
Part 3: How would you evaluate whether the search results themselves are delivering value to users?
Your answer should cover experimental design choices, metric selection rationale, and practical validation approaches.
Hints
Hint 1
Start with a clear hypothesis and identify what constitutes success before running the experiment
Hint 2
Consider both immediate engagement signals and downstream outcomes when selecting metrics
Hint 3
Combine behavioral data from user actions with direct measurement of result relevance
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Designing an Experiment to Measure Search Quality
Overview
This question tests three core competencies: rigorous experimental methodology, thoughtful metric design, and domain understanding of search quality. Strong answers demonstrate concrete decision-making, acknowledge trade-offs, and explain how to reconcile conflicting signals.
Part 1: Setting Up the A/B Test
Formulate a Testable Hypothesis
Begin with a specific, measurable prediction:
"Relocating the search button to the header will increase the proportion of users who complete a successful search by at least 3 percentage points, without degrading downstream conversion or increasing latency."
State both the alternative hypothesis and the null (no effect) upfront, along with your decision criteria.
Choose the Randomization Unit
Randomize by user (via stable identifier like account ID or device fingerprint), not by session or individual query.
Why this matters:
- Ensures each person sees a consistent experience across visits
- Prevents contamination between treatment and control
- User-level analysis is statistically cleaner
Note that if you track per-query metrics like click-through rate, you're now dealing with ratio metrics (multiple observations per randomization unit). Standard t-tests underestimate variance here. Use the delta method or bootstrap to get accurate confidence intervals.
Define Your Metric Hierarchy
Establish three tiers before launch:
- Primary metric (one only): Percentage of users with at least one successful search
- Secondary metrics: Supporting indicators that explain the primary movement (queries per user, click-through rate, time to click)
- Guardrails: Must-not-regress metrics like p95 latency, error rates, overall engagement, revenue
Calculate Required Sample Size
Example calculation:
- Current baseline: 12% of users have a successful search
- Target effect: 3 percentage points (25% relative lift)
- Standard parameters: α = 0.05 (two-tailed), 80% power
- Formula: n ≈ 16 · p(1−p) / δ² = 16 · 0.1056 / 0.03² ≈ 18,773 users per arm
Convert this to runtime using your daily eligible traffic. Always run for at least one full week to capture day-of-week patterns, regardless of when you hit sample size.
If you need more power with limited traffic, consider variance reduction techniques like CUPED, which uses pre-experiment behavior as a covariate.
Pre-Flight Validation
- A/A test: Run control vs. control first. If you see >5% false positives, your infrastructure has issues
- Instrumentation check: Verify events fire correctly in both arms using a small-scale smoke test
- Gradual ramp: Start at 1-5% traffic to catch edge cases before full rollout
Monitor During Execution
- Sample Ratio Mismatch (SRM): Use a chi-square goodness-of-fit test to confirm arm sizes match the intended split. An SRM invalidates the experiment
- Sequential peeking: Don't stop early based on p-values unless you're using a proper sequential testing framework (like always-valid p-values or alpha spending functions)
Analysis Phase
- Report effect size with confidence intervals, not just statistical significance
- Apply multiple testing correction (Benjamini-Hochberg) if analyzing many secondary metrics
- Check for novelty effects: Plot the treatment effect by day. A spike that decays suggests curiosity clicks, not sustainable improvement
- Examine segment heterogeneity (mobile vs. desktop, new vs. returning), but don't hunt for significance post-hoc
Make the Decision
Ship only when:
- Primary metric shows statistically significant improvement
- All guardrails remain within acceptable bounds
- The pattern across secondary metrics tells a coherent story
If search usage increases but conversion drops, investigate before launching. Conflicting metrics demand explanation, not averaging.
Part 2: Metrics for Search Button Performance
Structure metrics along the user journey:
Discovery & Entry
- Button visibility rate: Impressions of the search button per session
- Button click-through rate: Taps / impressions
- Search initiation rate: % of sessions or users starting a search
Engagement with Results
- Queries per searching user: Measures exploration depth
- Results click-through rate: % of queries getting at least one click
- Zero-results rate: % of queries returning no results
Success Signals
- Search success rate (primary): A query where the user clicks a result, dwells ≥30 seconds, and doesn't immediately reformulate
- Conversion from search: Purchases, sign-ups, or other goals completed after searching
- Time to first meaningful interaction: Latency from query submission to a substantive click
Failure Indicators
- Reformulation rate: % of queries followed by a modified query within 60 seconds
- Abandonment rate: Queries with no clicks (caveat: some abandonments are "good" when the answer appears in a widget)
- Pogosticking: Rapid back-clicks within 10 seconds
System Health
- Latency distribution: p50, p90, p99 response times
- Error and timeout rates
- Overall engagement: Sessions per user and time on site (to ensure we're not cannibalizing other features)
Critical insight: High button CTR is not inherently good. A more prominent button might attract accidental or exploratory clicks that don't lead anywhere. Always pair usage metrics with outcome metrics.
Part 3: Evaluating Search Result Quality
Use a multi-signal approach combining online behavior, offline evaluation, and direct feedback.
Online Behavioral Signals (Implicit)
Click-based quality:
- Long-click rate: % of clicks with dwell time >30s (or >10s for time-sensitive content)
- Mean Reciprocal Rank (MRR): 1/position of the first satisfied click. Higher MRR means relevant results rank earlier
- Click position distribution: Track how far down users scroll to find good results
Failure patterns:
- Reformulation within session: User rewrites the query shortly after seeing results
- No-click abandonment: Distinguish "good abandonment" (instant answer widgets) from "bad abandonment" (irrelevant results) using page-level features
- Back-click velocity: Clicks followed by an immediate return suggest poor relevance
Comparative evaluation:
- Interleaving: Blend results from two ranking algorithms on the same page (using team-draft interleaving) and measure which algorithm's results attract more clicks. This requires 10-100× less traffic than a full A/B test for algorithm comparison.
Offline Evaluation (Explicit)
Human relevance judgments:
- Sample representative queries (stratified across head, torso, and tail distributions)
- Trained raters assess (query, document) pairs on a graded scale (e.g., 0=irrelevant, 1=marginally relevant, 2=relevant, 3=highly relevant)
- Use detailed rating guidelines to ensure consistency
Metrics from judgments:
- NDCG@k (Normalized Discounted Cumulative Gain): Rewards relevant results positioned high, with diminishing credit for lower ranks
- Precision@k and Recall@k: Standard information retrieval metrics
- Coverage: % of sampled queries returning at least k relevant results
Quality assurance:
- Measure inter-rater agreement (Cohen's kappa or Fleiss' kappa for multiple raters)
- Refresh the evaluation set quarterly to prevent overfitting to static benchmarks
- Run side-by-side comparisons where raters directly choose the better result page
Direct User Feedback
- In-session ratings: "Was this helpful?" thumbs up/down on result pages
- Targeted micro-surveys: Sample 1-2% of search users for a single-question satisfaction survey post-search
- Issue reporting: Explicit "report a problem" option
Treat these signals as directional, not definitive. Response rates are low and skewed toward extreme experiences.
Triangulation Strategy
The key is validating online proxies against offline truth:
- Correlate long-click rate with human relevance scores to calibrate your dwell-time threshold
- If NDCG improves but click-through rate doesn't, investigate whether visual presentation undermines relevance
- Track how different quality dimensions (freshness, authority, comprehensiveness) map to user satisfaction
When signals conflict: Prioritize user outcomes over algorithmic scores. A ranking change that boosts NDCG but reduces conversion or retention likely has a flaw offline evaluation didn't catch (e.g., technically relevant but not actionable).
Common Pitfalls
- Measuring clicks in isolation: Clicks indicate interest but not satisfaction
- Ignoring novelty effects: Early enthusiasm often regresses to baseline
- Skipping guardrail metrics: A feature can improve search while harming overall product health
- Over-relying on offline metrics: Lab settings miss contextual factors like intent and task urgency
- Peeking at p-values: Checking significance repeatedly inflates false positive rates
Summary
A strong experiment design commits to decisions upfront (hypothesis, metrics, sample size), uses the correct randomization unit, validates instrumentation, and reconciles multiple data sources when interpreting results. For search specifically, the goal is sustainable user success, not just increased engagement with the button.