- a concise recap of what it does,
- clear signals for when to use it, and
- concrete example use cases.
1) Semantic search
RecapSemantic search converts a natural-language query into a vector embedding and returns items that are conceptually similar to that query. It prioritizes meaning over exact keyword matches. When to use semantic search
- Users type free-form text (not selecting from menus or entering product/model codes).
- You need meaning-based matching instead of exact keyword matching.
- Your data lacks consistent keywords; users describe intent or attributes rather than naming items.
- You are building conversational interfaces (chatbots, AI assistants) that must interpret intent.
- You are building Retrieval-Augmented Generation (RAG) systems where a retriever finds relevant documents to feed an LLM.
RAG stands for Retrieval-Augmented Generation. In RAG, a retriever (often a vector search) finds relevant documents which are then provided to a generative model to produce more accurate, context-aware responses.
- E-commerce: A shopper types “comfortable shoes for walking.” Semantic search matches that intent to product listings labeled “sneakers,” “walking shoes,” or “athletic footwear” even if the exact words differ.
- Customer support: A new support ticket written in different words than past tickets still returns relevant historical tickets and resolutions because semantic similarity captures intent and meaning.

2) K nearest neighbor (KNN) search
RecapKNN returns a fixed number
K of the most similar vectors using a chosen similarity or distance metric (e.g., cosine similarity, Euclidean distance, or dot product). Results are ordered from most to least similar.
When to use KNN
- You require an exact number of results (for example
top-5ortop-10). - Results must be ranked by similarity.
- Your UI or business logic expects a fixed count of recommendations or responses.
- The choice of similarity metric matters for relevance and should be selected intentionally.
- Recommendations: Show exactly 20 movies similar to the one a user just watched. Use KNN to retrieve the 20 closest movie vectors.
- Visual search: Upload an image and return the ten most visually similar products using cosine similarity over image embeddings.
3) Hybrid search
RecapHybrid search combines vector similarity (semantic relevance) with deterministic metadata filtering. It returns semantically relevant items while enforcing exact constraints such as price ranges, availability, or location. When to use hybrid search
- You need both semantic matching and hard attribute filters at the same time.
- Business constraints must be enforced (for example price caps or inventory availability).
- You want meaning-based retrieval but also reliable, deterministic filtering for exact fields.
- Real estate: Interpret “modern apartments near downtown” semantically, then apply filters such as
price < 2000,bedrooms = 2, andpet_friendly = trueto produce the final set of results. - Job search: Semantically match on skills and role (e.g., “machine learning engineer”) while applying filters like
location,salary_range, andremote/on-siteflags.

Quick comparison
| Method | Best for | Typical outputs |
|---|---|---|
| Semantic search | Free-text intent, conversational queries, RAG retrievers | Semantically similar items (no fixed count) |
| KNN search | Fixed-count, ranked recommendations | Top-K nearest neighbors ordered by similarity |
| Hybrid search | Semantic relevance + exact constraints | Semantically relevant results filtered by metadata |
Next steps
- Use semantic search when you need meaning-based matching or are feeding documents into an LLM.
- Use KNN when you need a fixed, ranked set of nearest items.
- Use hybrid when you must combine semantic relevance with strict metadata filters.