BM25
The standard keyword-search ranking formula: it scores documents by how often query words appear, weighting rare words more.
BM25 dates from the 1990s and is still the default ranking in engines such as Elasticsearch and OpenSearch. It rewards rare terms, dampens repeated ones and corrects for document length. It needs no model and no GPU, and it is exact on product codes, names and numbers, where embeddings are weak. It does not understand synonyms, which is why hybrid search combines it with vector search.
Related terms
- Hybrid search: Combining keyword search (such as BM25) with vector search, so results match both exact terms and meaning.
- Semantic search: Search that matches by meaning instead of exact words, by comparing embeddings of the query and the documents.
- Embeddings: Vectors of numbers that place texts with similar meaning close together.
- RAG (retrieval-augmented generation): Finding relevant documents first and putting them into the prompt, so the model answers from them.
