Keyword Search
Exact word matching search. A classic algorithm is BM25, which ranks documents based on term frequency and rarity.
How It Works
The query is broken into words, and documents where these words appear are found. The more frequently a word appears in a document and the rarer it is in the entire collection, the higher the weight.
Strengths
- Finds exact articles, numbers, and names;
- Fast and predictable;
- Does not require embeddings.
Weaknesses
- Does not understand synonyms ("car" ≠ "automobile");
- Does not capture paraphrases;
- Sensitive to typos.
Place in RAG
In advanced search, keyword search is combined with semantic search through EnsembleRetriever — this addresses both weaknesses.