Sub topic 15
Measuring and Improving Search
Search quality is a product behavior, not only a ranking algorithm. You need to learn whether people find the right item, how much effort they spend, and where they abandon the task.
This chapter assumes basic familiarity with web or mobile interfaces, form controls, lists, and TypeScript.
Choose metrics that describe the task
A useful measurement plan connects user actions to an outcome. For a product search, the outcome might be opening a product, adding it to a cart, or completing a purchase. For an admin search, it might be opening the correct record.
Track several kinds of metrics:
- Search success rate: the percentage of search sessions that reach a chosen success action.
- Zero-result rate: the percentage of submitted queries that return no results.
- Reformulation rate: the percentage of searches followed by another query in the same session.
- Search abandonment: the percentage of searches followed by no result interaction.
- Result interaction rate: the percentage of searches followed by a result click or open.
- Time to first useful result: the time from submission to the first meaningful interaction.
- Filter usage: which filters people use and whether those filters lead to useful results.
- Error and latency rates: how often searches fail or take longer than the interface promises.
No single metric proves that search works. A high click rate can mean that results are useful, or that users must open many results before finding the right one.
Instrument the complete search journey
Record events that let you reconstruct a search session. Include the query, result count, active filters, ranking version, and timing. Avoid storing sensitive query text when it could contain personal information. Hash, redact, or categorize values where appropriate.
A small event model might look like this:
type SearchEvent =
| {
type: "search_submitted";
sessionId: string;
queryLength: number;
resultCount: number;
filterCount: number;
latencyMs: number;
}
| {
type: "result_opened";
sessionId: string;
position: number;
resultId: string;
};
function searchSuccessRate(events: SearchEvent[]): number {
const submitted = events.filter(
(event) => event.type === "search_submitted"
);
const sessionsWithOpen = new Set(
events
.filter((event) => event.type === "result_opened")
.map((event) => event.sessionId)
);
if (submitted.length === 0) return 0;
const successful = submitted.filter((event) =>
sessionsWithOpen.has(event.sessionId)
).length;
return successful / submitted.length;
}
console.log(
searchSuccessRate([
{
type: "search_submitted",
sessionId: "a",
queryLength: 5,
resultCount: 12,
filterCount: 0,
latencyMs: 180,
},
{ type: "result_opened", sessionId: "a", position: 2, resultId: "p7" },
])
);Define the session boundary before calculating rates. A session might end after 30 minutes of inactivity, after a successful action, or when the user leaves the task. Use one definition consistently.
Diagnose before changing the design
Segment metrics by query type, device, language, result count, and filter combination. A good overall success rate can hide a serious problem for mobile users or for long-tail queries.
Look for patterns:
- High zero-result rate suggests missing synonyms, poor normalization, or incomplete data.
- High reformulation rate suggests that users cannot express their intent or that ranking is weak.
- Many clicks at low positions suggest that the best result may be ranked too low.
- High latency followed by abandonment suggests that feedback or performance needs work.
- Frequent filter removal suggests that labels, counts, or combinations are confusing.
Use qualitative evidence with quantitative data. Search logs show what happened. Usability tests and support conversations help explain why.
Test changes safely
Form a hypothesis before changing search. For example: “Showing category suggestions will reduce reformulations for broad queries.” Choose a primary metric, such as successful sessions, and guardrail metrics, such as latency, error rate, and revenue.
Compare the change with a control group when the product has enough traffic. For smaller products, use moderated usability tests, task completion rates, and repeated reviews of search logs. Do not optimize for clicks alone. A result that earns a click but causes a quick return to search may be a poor result.
Exercise
A search has a low zero-result rate but a high reformulation rate. What should you investigate first?
Show answer
Inspect ranking, result relevance, query intent, and whether users can understand the returned results. The first query may return items, but not the items users need.