AAA Adrian Alvarez Alonso Portfolio
Search and AI: The Dream Team for an eCommerce Revenue Boost

Search and AI: The Dream Team for an eCommerce Revenue Boost

Discover how integrating Orama.search with OpenAI embeddings transformed search UX and conversion for a personalized store

๐Ÿงฉ The Challenge: UX That Converts for Niche eCommerce

Our client runs a personalized padel t-shirt eCommerce site. They wanted:

  • Faster and more relevant product search
  • The ability to personalize empty state experiences
  • Future integration with an AI chatbot

This wasnโ€™t just about search โ€” it was about making intelligent UX part of conversion rate optimization (CRO).


๐Ÿš€ The Stack: Orama.search + OpenAI + Sanity

We chose Orama.search for its:

  • Lightweight architecture and speed
  • Native support for vector-based search (with OpenAI embeddings)
  • Developer-friendly API (can be updated via REST, CLI, SDKs)

It let us go beyond standard search to implement answer engine logic, automations, and personalized search outputs โ€” all while staying fully headless.

๐Ÿ”„ Dynamic Product Updates (Sanity + Cron + GROQ)

Instead of manually syncing product data to the vector database, we automated it with a cron job and a GROQ query from Sanity CMS:

// /api/update-orama-db.ts

const manager = new CloudManager({
  api_key: process.env.ORAMA_PRIVATE_API_KEY!
})
const indexManager = manager.index('xxxxxxxxxxxxxxxxx') // Remplace con tu ID de รญndice

export const GET = async () => {
  try {
    const products = await sanityClientRead.fetch(
      GET_ORAMA_PRODUCTS_FOR_UPDATING // Consulta GROQ de Sanity
    )

    await indexManager.update(products)
    await indexManager.deploy()

    return NextResponse.json('OK', { status: 200 })
  } catch (error) {
    return NextResponse.json(
      { error: 'An error occurred', details: error },
      { status: 500 }
    )
  }
}

๐Ÿ’ก Bonus: This system supports updates via CMS actions, CLI tools, or custom scripts.


๐Ÿ” The Search Page: UX Meets Relevance

Hereโ€™s a snippet of how we used Orama to offer intelligent search with fallbacks:

const { search } = await searchParams // Next.js 15 searchParams

const oramaResponse = await oramaClient.search({
  term: search as string,
  mode: 'hybrid'
})

if (!oramaResponse) {
  log.error('Products not found', { oramaResponse })
}

๐Ÿ’ก Bonus: This same idea is used on the custom 404 page to search for related products


We also leveraged past behavior and wishlist data to:

  • Prioritize last-minute-viewed products
  • Insert smart call-to-actions inside search result lists
  • Suggest relevant bundles for quick checkout boosts

๐ŸŽฏ CRO Techniques Enabled

By combining AI-powered search with UX intelligence, we implemented:

โœ… Personalized 404/empty search pages โœ… Wishlist-based smart carousels โœ… Product slug disambiguation (typo handling) โœ… Search result re-ranking based on behavioral insights

These micro-improvements reduced bounce rate and nudged more sessions into purchase flow.


๐Ÿง  Why Orama Over Meilisearch/Typesense/Algolia?

  • Open-source, lightweight and cost-effective
  • Built-in support for vector search + OpenAI embeddings
  • Native REST + CLI + SDK support for automation
  • Developer-focused design and instant local setup

It gave us AI-enhanced flexibility without the SaaS pricing headaches.


๐Ÿ”ฎ Whatโ€™s Next: AI Chatbot Integration

The next phase of this project will bridge Orama with OpenAI to create an in-site product assistant. It will:

  • Guide users via chat toward relevant products
  • Pull real-time insights from the search index
  • Respond to wishlist/product queries

With Oramaโ€™s answer engine and embeddings already in place, this will be a smooth evolution.


๐Ÿ’ผ Want to Build Something Like This?

I help eCommerce brands implement intelligent UX with modern stacks โ€” from search and chatbots to CRO and headless architectures.

๐Ÿ‘‰ Letโ€™s Talk | See More Projects