A search methodology that retrieves results based on the meaning and intent of a query rather than exact keyword matches, using vector embeddings to capture semantic relationships between concepts.
Traditional search is like looking for a book by its exact title. If you search “artificial intelligence,” you only find books with those exact words.
Semantic search is like asking a librarian “books about smart machines.” The librarian understands you might want books about AI, robotics, machine learning, or even philosophy of mind — even if those exact words don’t appear in your query. It searches by meaning, not just keywords.
Semantic search works by converting both queries and documents into high-dimensional vector embeddings, then finding documents whose embeddings are most similar to the query embedding.
The Pipeline:
Hybrid Search: Modern systems combine semantic search with traditional keyword search (BM25) to get the best of both worlds:
Key Metrics:
Semantic search is transforming enterprise information retrieval:
Applications:
ROI Drivers:
A knowledgeable concierge at a hotel. You say “I want to see something beautiful and historic.” The concierge doesn’t search for “beautiful historic” — they understand you might want museums, historic districts, architectural landmarks, or scenic viewpoints. They retrieve options based on meaning.
# Semantic search using sentence-transformers and FAISS
from sentence_transformers import SentenceTransformer
import faiss
import numpy as np
# Load embedding model
model = SentenceTransformer('all-MiniLM-L6-v2')
# Documents to search
documents = [
"The cat sat on the mat",
"A feline rested on the rug",
"Dogs are loyal companions",
"Python is a programming language",
"Machine learning models learn from data"
]
# Create embeddings
doc_embeddings = model.encode(documents)
# Build FAISS index
dimension = doc_embeddings.shape[1]
index = faiss.IndexFlatL2(dimension)
index.add(doc_embeddings.astype('float32'))
# Search query
query = "kitten sitting on carpet"
query_embedding = model.encode([query])
# Find most similar documents
distances, indices = index.search(query_embedding.astype('float32'), k=3)
print("Query:", query)
print("Top results:")
for idx in indices[0]:
print(f" - {documents[idx]}")
# Returns: "The cat sat on the mat", "A feline rested on the rug"
# Even though query used different words ("kitten", "carpet")
Reality: They’re complementary. Keyword search excels at exact matches (product codes, names); semantic search excels at conceptual matches. Hybrid search combines both.
Reality: Quality depends on the embedding model. Poor embeddings lead to poor semantic search. Domain-specific embedding models often outperform general-purpose ones.