nahom endale
Case StudiesAboutResume
Nahom Endale

© 2026 Nahom Endale, New York

Case StudiesAboutResumeGitHubLinkedIn
Nahom Endale/Case studies/Natural Language Search
View the app ↗N

Natural Language Search

OpenAI to Algolia query translator

OpenAI · Structured outputs

Zod · Schema validation

Algolia · Precise query generation

150+ · Real-world queries tuned

01The 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.

02The 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.

03Features

+

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

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

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

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

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

Reliably delivers precise results without hand-built filter UIs.

04System Architecture

+

Input

Free-text query

API

Next.js API

AI

OpenAI + Zod

Search

Algolia

Output

Ranked results

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Input

Free-text query

API

Next.js API

AI

OpenAI + Zod

Search

Algolia

Output

Ranked results

05Technology Stack

+

Next.js · TypeScript

OpenAI Structured Outputs · Zod

Algolia · Neon (Postgres)

06Key Learnings

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

AI / Search Engineering

Next.js, OpenAI API, Zod, Algolia, Neon (Postgres), TypeScript

previous← BravoResumenextOxeoxe →