Implementing Semantic Search
Leverage AI-powered vector search to power intelligent answer generation
Semantic search uses AI to understand the meaning and intent behind search queries, delivering more relevant results than traditional keyword matching.
What is Semantic Search?
Traditional search matches keywords exactly:
- Query: "running shoes" → Only finds products with those exact words
Semantic search understands meaning:
- Query: "footwear for jogging" → Finds running shoes, sneakers, athletic shoes
- Query: "workout gear for feet" → Also finds relevant products
How It Works
SearchAF's semantic search uses:
- Embedding Models: Convert text to vector representations
- Vector Database: Store and search high-dimensional vectors
- Similarity Search: Find products with similar meaning
- Hybrid Ranking: Combine semantic and keyword signals
Enabling Semantic Search
Via Dashboard
- Navigate to your project settings
- Go to "Search Configuration"
- Toggle "Semantic Search" on
- Choose your embedding model:
- Fast: Lower latency, good accuracy
- Accurate: Higher latency, best accuracy
- Click "Save"
Via API
Enable semantic search in your search requests:
curl https://searchaf-api.antfly.io/api/v1/search \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "comfortable shoes for hiking",
"semantic": true,
"hybrid_weight": 0.7
}'
The hybrid_weight parameter controls the balance:
0.0: Pure keyword search0.5: Equal weight to semantic and keyword1.0: Pure semantic search
Best Practices
Optimize Product Descriptions
Semantic search works best with rich, descriptive content:
Good:
Women's Trail Running Shoes - Waterproof hiking footwear with
superior grip and cushioning for outdoor adventures
Bad:
Shoes - Blue - SKU12345
Use Natural Language
Write product descriptions the way customers search:
- Include synonyms and related terms
- Describe use cases and benefits
- Add context about who it's for
Configure Relevance Tuning
Fine-tune which fields contribute to semantic matching:
{
"semantic_fields": {
"title": 0.4,
"description": 0.4,
"tags": 0.2
}
}
Advanced Features
Multi-Language Support
Semantic search works across languages:
{
"query": "chaussures de course",
"language": "fr",
"semantic": true
}
Custom Embeddings
Use your own embedding model:
- Train or select a custom model
- Upload to SearchAF
- Configure in project settings
Query Expansion
Automatically expand queries with related terms:
{
"query": "laptop",
"semantic": true,
"expand_query": true
}
This might expand to: "laptop computer notebook portable pc"
Monitoring Performance
Track semantic search effectiveness:
- Click-Through Rate: Are users clicking results?
- Conversion Rate: Are searches leading to purchases?
- No-Result Queries: Which queries return nothing?
- Latency: Is response time acceptable?
Cost Considerations
Semantic search uses more compute resources:
- Embedding Generation: ~2-5ms per query
- Vector Search: ~10-50ms depending on catalog size
- Storage: ~1KB per product for embeddings
Plan your tier accordingly based on query volume.