BM25 powers billions of searches daily. But 90% of developers can't...

@femke_plantinga
Femke Plantinga@femke_plantinga
11 views Oct 29, 2025 ~1 min read
1
BM25 powers billions of searches daily.

But 90% of developers can't explain how it actually ranks results.

๐—•๐— ๐Ÿฎ๐Ÿฑ๐—™ is the algorithm that powers keyword search in most modern search engines.

Here's a super simple breakdown of how BM25 works:

โ€ข ๐—ง๐—ฒ๐—ฟ๐—บ ๐—™๐—ฟ๐—ฒ๐—พ๐˜‚๐—ฒ๐—ป๐—ฐ๐˜† (๐—ง๐—™) counts how often your search terms appear in a document.
โ€ข ๐—œ๐—ป๐˜ƒ๐—ฒ๐—ฟ๐˜€๐—ฒ ๐——๐—ผ๐—ฐ๐˜‚๐—บ๐—ฒ๐—ป๐˜ ๐—™๐—ฟ๐—ฒ๐—พ๐˜‚๐—ฒ๐—ป๐—ฐ๐˜† (๐—œ๐——๐—™) measures how rare your search term is across all documents. The word โ€˜sportsโ€™ might appear a lot in a collection of sports articles, but โ€˜AIโ€™ would be rarer, and weighted more heavily.
โ€ข ๐——๐—ผ๐—ฐ๐˜‚๐—บ๐—ฒ๐—ป๐˜ ๐—Ÿ๐—ฒ๐—ป๐—ด๐˜๐—ต ๐—ก๐—ผ๐—ฟ๐—บ๐—ฎ๐—น๐—ถ๐˜‡๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Short documents get weighted higher because each word has more โ€œweightโ€ in how important it is.

But wait, there's moreโ€ฆ

โœจ๐—•๐— ๐Ÿฎ๐Ÿฑ๐—™โœจ extends this to handle multiple fields: title, abstract, and body text with different importance weights. Your title matches might matter more than body text matches.

๐—ง๐—ต๐—ฒ ๐—ฟ๐—ฒ๐—ฎ๐—น๐—ถ๐˜๐˜† ๐—ฐ๐—ต๐—ฒ๐—ฐ๐—ธ:
BM25 is fast and doesn't need fancy embeddings or models. But it's still just matching exact tokens - it won't understand that "car" and "automobile" mean the same thing.

That's why modern search often combines BM25 with vector search, which uses AI embedding models to capture the meaning of words or phrases, in hybrid approaches. Best of both worlds.

Learn more: docs.weaviate.io/weaviate/searcโ€ฆ
Media image
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • LinkedIn & Instagram Carousel Maker
Create Free Account

Includes 7-day Premium trial