Semantic Search Personalization with LLMs

Why Search Is the New Personalization Battleground

Product discovery is broken when search is dumb. If a shopper types “running gear” and only sees a few shoes, you’ve lost them. Amazon, TikTok, and Instagram have raised the bar—people expect search to understand intent, not just keywords.

Shopify’s Search & Discovery app and Storefront API are solid, but they’re built on catalog metadata. The next frontier is LLM-powered semantic search—where queries are re-ranked and tailored to customer context.


The Building Blocks

1. Shopify Search & Discovery App

  • Powers synonyms, boosts, and related product recs.

  • Great baseline, but limited to metadata + rules.

2. Storefront API

  • productRecommendations query for related/complementary items.

  • Search query endpoint for custom builds in Hydrogen or headless storefronts.

3. LLM + Embeddings

  • Generate vector embeddings for product descriptions.

  • Compare user query embeddings to product embeddings → find “semantic nearest neighbors.”

  • Re-rank results by similarity + personalization signals (history, tags, location).


Personalization Layers on Top of Semantic Search

  1. Identity-Aware Search

    • Logged-in customer sees prioritized results for categories they’ve bought before.

  2. Contextual Ranking

    • Query: “outdoor jacket” → rank “waterproof” higher for geo = Seattle.

  3. Style Profiles (Metaobjects)

    • Query: “dress” → prioritize “casual” vs. “formal” depending on profile.

  4. Discovery Balance

    • Always leave ~20% results “exploratory” to avoid filter bubbles.


Copilot Kit: Semantic Search Prototype

Fire these prompts in VS Code with Copilot Agent Mode:

1. Storefront Search Query

Create: "Write a GraphQL Storefront API query that searches for 'running gear' and returns title, handle, and metafields for the top 10 products."

2. Embedding Service Hook

Create: "Generate a Next.js API route that takes the Storefront results, calls an embeddings model (e.g., OpenAI or HuggingFace), and computes similarity scores against the user query."

3. Re-Ranker

Create: "Write a TypeScript function that merges Shopify's relevance scores with embedding similarity + personalization weights (e.g., +0.2 if customer.tag='VIP', +0.1 if geo matches)."

4. Client-Side Integration

Edit: "Update Hydrogen search results component to call the semantic API route, display re-ranked results, and fallback to default if embeddings fail."

Why This Matters

  • Better UX: Customers feel “understood” when search matches intent.

  • Higher Conversion: Semantic relevance boosts click-through and cart adds.

  • Defensible Advantage: Most Shopify stores still run keyword-only search.


Takeaway: Search is no longer just matching words—it’s matching meaning. With semantic search and personalization, your Shopify store can deliver TikTok/Amazon-level discovery experiences right now.