Nahom Endale
N

AI / Search Engineering

Natural Language Search

OpenAI to Algolia query translator

View the app

OpenAI

Structured outputs

Zod

Schema validation

Algolia

Precise query generation

150+

Real-world queries tuned

The Challenge

Rug & Kilim's team wanted search to mirror how designers actually think, phrases like "6x9 Scandinavian under $5000 in beige", rather than wrestling with a wall of dropdown filters.

The Solution

A middleware layer turns free-text into precise Algolia queries: OpenAI structured outputs, constrained by a Zod schema, translate a designer's phrase into a validated query object mapping size, material, color, price, and stock status, all while staying editable by non-technical teammates.

Features

Free-text queries

Designers type how they think, e.g. '6x9 Scandinavian under $5000 in beige', instead of using filters.

NL to Algolia

OpenAI structured outputs translate the phrase into a precise Algolia query object.

Schema-validated

Zod constrains the model's output so only valid, well-typed queries reach Algolia.

Attribute-aware

Maps language to real attributes: size, material, color, price, and stock status.

Team-editable

Built so non-technical teammates can adjust the mapping logic.

Production automation

Reliably delivers precise results without hand-built filter UIs.

System Architecture

Input

Free-text query

API

Next.js API

AI

OpenAI + Zod

Search

Algolia

Output

Ranked results

Technology Stack

Frontend & Framework

Next.jsTypeScript

AI & Validation

OpenAI Structured OutputsZod

Search & Data

AlgoliaNeon (Postgres)

Key Learnings

  • Constraining the model with Zod turned free-form AI output into reliable, well-typed Algolia queries.
  • Mapping natural language to real product attributes mattered more than the prompt, the schema was the contract.
  • Tuning against 150+ real-world queries surfaced the edge cases that made it production-ready.
Professional headshot

Available for work

Let's build something.

Always interested in new opportunities, technical challenges, or collaborations. Reach out through any of the channels.También hablo Español!

Typically respond within 24 hours