# Semantic Search Semantic search finds information based on meaning and intent rather than exact keyword matches. It uses [[Embeddings]] to represent queries and documents as vectors, then finds results by measuring semantic similarity in vector space. Unlike traditional keyword search, semantic search understands that "car" and "automobile" are related, and that "best pizza near me" is looking for restaurant recommendations. ## How It Works Traditional Search: "running shoes" → matches documents containing "running" AND "shoes" Semantic Search: "running shoes" → finds documents about: - running shoes (exact) - jogging footwear (synonym) - athletic sneakers (related) - marathon gear (contextual) ## Pipeline Query → Embed → [[Vector Store]] → Similarity Search → Ranked Results 1. **Embed query**: Convert search text to vector using embedding model 2. **Search vectors**: Find nearest neighbors in vector store 3. **Rank results**: Order by similarity score 4. **Return**: Documents with highest semantic relevance ## Semantic vs Keyword Search | Aspect | Keyword Search | Semantic Search | |--------|---------------|-----------------| | Matching | Exact terms | Meaning/intent | | Synonyms | Manual configuration | Automatic | | Typos | Fails or fuzzy match | Often handles well | | Context | None | Understands context | | Setup | Simple | Requires embeddings | | Speed | Very fast | Slightly slower | ## Hybrid Search Combines both approaches for best results: - **Keyword**: High precision for exact matches - **Semantic**: High recall for related content - **Fusion**: Merge and rerank results ## Use Cases - Document/Knowledge Base search - E-commerce product discovery - Customer support knowledge bases - Code search across repositories - [[Retrieval-Augmented Generation (RAG)]] retrieval step ## References - https://www.pinecone.io/learn/semantic-search/ - https://www.elastic.co/what-is/semantic-search ## Related - [[Embeddings]] - [[Vector Store]] - [[Retrieval-Augmented Generation (RAG)]] - [[RAG Pipelines]] - [[LangChain]]