Prompt

How do I search similar products using embeddings?

Technology / Databases2 observationsLast seen Oct 14, 2026

Latest observation

Oct 14, 2026OpenAI APIWeb search: off

To search for similar products using embeddings, you generally do this:

1) Turn each product into a vector

Create an embedding for each product using a model that converts text or multimodal content into a numeric vector.

Typical product text to embed:

  • title
  • description
  • category
  • brand
  • key attributes
  • maybe reviews or tags

Example input:

Nike Air Zoom Pegasus 40 running shoes, men's, breathable mesh, size 10

The embedding model outputs a vector like:

[0.12, -0.04, 0.88, ...]

Products with similar meaning get vectors that are close together.


2) Store embeddings in a vector index

Save each product’s embedding in a vector database or search index, such as:

  • FAISS
  • Pinecone
  • Weaviate
  • Milvus
  • Elasticsearch / OpenSearch with vector search
  • PostgreSQL with pgvector

You also store metadata:

  • product_id
  • title
  • price
  • category
  • availability

3) Embed the query product or search text

When a user searches:

  • embed the query text, or
  • embed a “source product” if doing “similar items” recommendations

Example:

"lightweight running shoes for men"

Convert that into a vector using the same embedding model.


4) Find nearest vectors

Search the index for the top-k closest product vectors using a similarity metric like:

  • cosine similarity
  • dot product
  • Euclidean distance

The nearest vectors are your most similar products.


5) Filter and rerank if needed

Usually you’ll want business filters first:

  • same category
  • in stock
  • price range
  • region

Then rerank results with:

  • additional text similarity
  • boosted attributes
  • popularity
  • personalization
  • a cross-encoder / LLM reranker for better precision

Simple workflow

  1. Embed all products offline.
  2. Store embeddings in a vector DB.
  3. Embed the search query at runtime.
  4. Retrieve nearest neighbors.
  5. Apply filters and rerank.
  6. Return results.

Example with cosine similarity

If you already have embeddings:

import numpy as np

def cosine_similarity(a, b):
    return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))

query_emb = ...
product_embs = ...

scores = [cosine_similarity(query_emb, p) for p in product_embs]
top_indices = np.argsort(scores)[::-1][:10]

Tips for better product search

  • Use rich product text, not just titles.
  • Normalize product data before embedding.
  • Combine embeddings with structured filters.
  • Consider separate embeddings for:
    • title
    • description
    • image
  • If products are visual, use multimodal embeddings.
  • Re-embed when product details change.
  • Cache embeddings for performance.

If you want “similar products to this item”

A common pattern is:

  • User views product A
  • Embed product A
  • Retrieve nearest neighbors excluding itself
  • Filter by category/availability
  • Show top similar items

If you want, I can also show:

  1. a full Python example with FAISS or pgvector, or
  2. how to do this in OpenSearch/Pinecone.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.