POST /products/search
Request body
Natural language search query describing what the user is looking for
Maximum number of products to return in the search results
Response
The original search query submitted by the user
AI-generated recommendation text from Google Gemini based on the search results and query context
Array of products matching the search query, ordered by semantic similarity
How it works
The semantic search process:- Query embedding: Your natural language query is converted to a 3072-dimensional vector using Google’s Gemini embedding model
- Vector similarity: The query vector is compared against all product embeddings in the database using cosine similarity via pgvector
- Result ranking: Products are ranked by semantic similarity score, not just keyword matching
- AI recommendation: The top results are sent to Google Gemini LLM along with the original query to generate a personalized recommendation
Unlike traditional keyword search, semantic search understands the meaning and intent behind your query. Searching for “laptop for programming” will match products even if they don’t contain those exact words.
Example queries
Here are some example natural language queries you can use:- “I need something for gaming”
- “Looking for professional work clothes”
- “Want to buy ingredients for Italian cooking”
- “Need a gift for a tech enthusiast”
- “Searching for outdoor camping equipment”