Semantic Search Guide
Learn how to use natural language queries to find products that match user intent.
What is Semantic Search?
Semantic search goes beyond keyword matching to understand the meaning and intent behind search queries. Instead of just looking for exact word matches, it uses vector embeddings and natural language processing to find products that conceptually match what users are looking for.
Key Benefits
- Intent Understanding: Matches user intent rather than just keywords
- Natural Language: Works with conversational queries
- Better Results: Finds relevant products even with different terminology
- Context Aware: Understands relationships between concepts
How It Works
Our semantic search system converts both product descriptions and search queries into high-dimensional vectors using advanced language models. These vectors capture semantic meaning, allowing us to find products that are conceptually similar to the search query.
Basic Search Example
Query: "wireless headphones for running"
Matches:
- Bluetooth sports earbuds
- Sweat-resistant wireless headphones
- Athletic wireless earphones
API Implementation
The search endpoint automatically uses semantic search when you provide natural language queries. No special configuration is needed - simply send your query as text.
Python Example
import requests
API_KEY = 'YOUR_API_KEY'
SEARCH_URL = 'https://api.abbababa.com/v1/search'
def find_products(query):
response = requests.post(SEARCH_URL,
json={
'query': query,
'limit': 10
},
headers={
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
}
)
if response.status_code == 200:
products = response.json()['data']
print(f'Found {len(products)} products:')
for product in products:
print(f'- {product["title"]} ({product["price"]})')
else:
print(f'Error: {response.status_code}')
# Example queries
find_products('laptop bag for commuting')
find_products('eco-friendly water bottle')
find_products('warm winter jacket for hiking')Node.js (with Axios) Example
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const SEARCH_URL = 'https://api.abbababa.com/v1/search';
async function findProducts() {
try {
const response = await axios.post(SEARCH_URL, {
query: 'lightweight laptop sleeve for a 13-inch macbook air',
limit: 5,
}, {
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
}
});
console.log('Found ' + response.data.data.length + ' products:');
response.data.data.forEach(product => {
console.log('- ' + product.title + ' (' + product.price + ')');
});
} catch (error) {
console.error('Error fetching products:', error.response?.data || error.message);
}
}
findProducts();Best Practices & Troubleshooting
- Be Descriptive: Include context and use cases in your queries
- Use Natural Language: Write queries as you would speak them
- Include Key Attributes: Mention important features like size, color, material
- Combine with Filters: Use semantic search with price/category filters for best results
Query Examples
Good Queries
- "noise cancelling headphones for work"
- "durable phone case for outdoor activities"
- "ergonomic office chair under $300"
- "gifts for coffee lovers"
Less Effective
- "headphones"
- "case"
- "chair"
- "gift"
Advanced Features
Quality Scoring
All search results include a quality score that indicates how well the product matches your query. Higher scores mean better semantic matches.
Multi-language Support
Our semantic search supports multiple languages. Queries in different languages will still find relevant products, though English typically provides the best results.
Context Awareness
The system understands context and relationships. For example, searching for "winter gear" will find coats, boots, gloves, and other cold-weather items even if they don't explicitly mention "winter".