📌 Keyword Search (The Exact Match)
Traditional search engines (like standard Elasticsearch) use Keyword Search (also known as Lexical Search). They rely on algorithms like BM25 to count how many times your exact search words appear in a document.
The Pros: It is incredibly exact. If you are searching an inventory database for a specific part number like "AX-4902-B", keyword search will instantly find the exact document containing that string.
The Cons: It is entirely literal. It has no understanding of human meaning, synonyms, or typos. If a user searches for "puppy", a keyword search will completely ignore a highly relevant document that only uses the words "young dog".
📌 Semantic Search (The Meaning Match)
Modern AI search engines use Semantic Search (Vector Search). As we learned in previous lessons, they convert the search query into a mathematical vector and look for documents with a similar trajectory (Cosine Similarity).

The Pros: It understands intent and context perfectly. If you search for "puppy", it will instantly find documents about "young dogs" and "canines" because their vectors are clustered together.
The Cons: It is "fuzzy" and bad at exact matches. If a mechanic searches your database for the exact error code "ERR-592", semantic search might return documents about "ERR-593" just because the error codes look "semantically similar" to the AI. This is a disaster in an enterprise setting.
📌 The Ultimate Solution: Hybrid Search
So, which one should you use? In modern AI applications, the answer is Both.
The industry standard for building world-class search (and RAG pipelines) is Hybrid Search. You run a Keyword Search and a Semantic Vector Search simultaneously.

To combine the two different lists of results, developers use a mathematical formula called Reciprocal Rank Fusion (RRF). This algorithm takes the rankings from the BM25 Keyword Search and the rankings from the Vector Search, and merges them together.
The result is a "best of both worlds" search bar that can understand the nuanced meaning of a user's question, while still perfectly matching hard part numbers, names, and error codes.
Quick Knowledge Check
Test what you just learned about search types
Question 1 of 1
If you are building a search engine for a hardware store's inventory, what is the biggest danger of relying ONLY on Semantic Vector Search?
Loading results...