Why Search Returned the Wrong Supabase Pricing Page
ملخص
Pixel shares how its web search engine returned an unrelated investment page for the query supabase pricing, revealing three bugs in its ranking pipeline. The announcement explains how candidate selection, stemming, and staged scoring can undermine search relevance, and why fixing these issues matters for reliable results.
DEV Community
Why our search engine returned T. Rowe Price for "supabase pricing"
We run our own web search engine, with our own crawler and index. Last week someone told us they were about to benchmark it by asking every search API the same simple questions, like "notion pricing" or "figma pricing", and checking whether the right page comes back first. So we tried it ourselves first. "linear pricing" returned linear.app/pricing. "notion pricing" was fine. Then we typed "supabase pricing" and got this as the top result: troweprice.com, a page about investment insights. T. Rowe Price. A fund manager. Nothing to do with Supabase. That one query led us to three separate bugs. None of them was exotic, and all three were the kind that hide behind a ranking pipeline that "mostly works". Here is what they were and how we fixed them. How a query flows through our ranker To understand the bugs you need the rough shape of the pipeline: Tokenize and stem the query. "pricing" becomes "price", "supabase" becomes "supabas". Collect candidates from the posting lists of each term. If there are too many candidates, sample them down to a fixed budget. Stage 1, a cheap pre-score: term presence weighted by IDF, then term frequency for the top few thousand. No documents are loaded. Stage 2, full scoring for the best candidates: BM25, title and URL matches, phrase and proximity, domain signals. Each stage hands the next one a smaller list. A page that falls out early never gets a chance later, no matter how good it is. Bug 1: a small, perfect set of candidates got thrown away For a two-word query, step 2 takes the intersection: pages that contain both words. The code had a fallback for when the intersection is tiny: candidates = docs[a] & docs[b]
if len(candidates) < 20:
candidates = docs[a] | docs[b] # widen with a union
That looks reasonable. It is not, when one word is rare and the other is very common. "figma" appears in relatively few pages. "price" appears in about a hundred times more. Pages with both words are few, and they are exactly the right ones (figma.com/pricing is among them). But because there were fewer than 20, the code replaced that small, precise set with the union of both lists. Now almost every candidate was a page that only mentions "price". Step 3 then sampled that huge set down to the budget, and the handful of real matches were very likely to be dropped before anything scored them. That is how a fund manager wins "supabase pricing": among thousands of pages that only say "price", a big, authoritative finance site scores well. The fix: keep every full match, and only widen with the specific word. both = docs[a] & docs[b]
if len(both) < 20:
specific = [t for t in terms if df(t) <= 50_000] or terms
rest = union(docs[t] for t in specific) - both
rest = even_sample(rest, budget - len(both)) # never drop full matches
candidates = both | rest
A page without the brand name is rarely what someone typing "figma pricing" wants, so widening with "price" alone was never useful. And the widened set stays under the sampling threshold, so the full matches survive into scoring. Bug 2: we stemmed every query twice After fixing Bug 1, our offline evaluation looked great, but the live site still returned T. Rowe Price. The evaluation script called the ranker directly. The website goes through one more layer, which normalizes the query for its cache key: tokens = tokenize(query) # ["supabas", "price"]
normalized = " ".join(tokens) # "supabas price"
results = ranker.search(normalized) # the ranker tokenizes again
The ranker tokenizes and stems its input. So the already-stemmed text was stemmed a second time, and the Porter stemmer is not idempotent: word stemmed once stemmed twice supabase supabas supaba pricing price price figma figma figma "supaba" is not a word in any document. With one of its two terms matching nothing, the query effectively became "price". Same symptom as Bug 1, completely different cause. This was not specific to Supabase. Any word whos...

Powered by Readybot.io