logo

Natural Language Search Configurator

AI-assisted interface that transforms free-text interior designer queries into structured Algolia search JSON using OpenAI’s Structured Outputs and Zod validation.

AI / Search Engineeringapp.rugandkilim.com

I. The Challenge

Rug & Kilim’s team wanted search to mirror how designers actually think—phrases like “6×9 Scandinavian under $5000 in beige” rather than dropdown filters. The challenge was to interpret that natural input, convert it into valid Algolia queries, and still respect business constraints such as product taxonomies, stock status, and pricing logic — all while remaining editable by non-technical teammates.

II. The Solution & Architecture

Built a modular Natural Language → Algolia JSON pipeline using OpenAI’s responses.parse() with Zod schema enforcement. Added a Neon (Postgres) backend for storing evolving prompt rules and a collaborative “Questions Bank” where staff could log and refine real-world queries. The frontend provides authenticated editors an interface to test, adjust, and validate prompt behavior in real time.

System Architecture

Next.js Interface
Authenticated playground to test AI-to-Algolia translations
OpenAI Structured Outputs
Converts natural text into Zod-validated JSON schema
Zod Schema Validation
Guarantees strict typing of facet and numeric filters
Algolia Index (wp_posts_product)
Executes generated structured queries instantly
Rules API (Neon DB)
Stores custom prompt modifiers and system rules
Questions Bank
Centralized log of 150+ designer search phrases
WordPress Auth Layer
Restricts access to internal team members only
Netlify + Cloudflare
Serverless hosting and edge caching for AI queries

III. Technology Stack

Frontend

  • Next.js 15 + App Router
  • Tailwind UI + ShadCN Components
  • React Hooks for Rules & Questions
  • JWT Auth via WordPress API

Backend & AI

  • OpenAI Responses API (Structured Outputs)
  • Zod Schema Validation
  • Algolia Search API
  • Next.js Server Actions

Database & Automation

  • Neon (Postgres Serverless)
  • Prompt Rules & Questions Bank Tables
  • Automated Rule Activation Flow
  • Zod Error Logging for Debugging

Infrastructure & Analytics

  • Netlify Deployments + Edge Functions
  • Cloudflare Cache + Analytics
  • Algolia Logs for Search Accuracy
  • PostHog Behavior Tracking

IV. Results & Impact

150 +

Real designer queries collected and parsed

100 %

Schema-validated Algolia JSON with zero malformed responses

< 6 s

Average AI + Algolia end-to-end latency

Live Beta

Used internally to train AI prompt rules and monitor accuracy

Key Learnings

  • Combining Zod schemas with OpenAI Structured Outputs ensured consistent, production-ready JSON.
  • Allowing non-engineers to add rules and queries accelerated prompt training and context coverage.
  • Schema-driven search bridges AI interpretation with deterministic E-commerce filters.
Professional headshot

Let's Connect

I'm always interested in discussing new opportunities, technical challenges, or potential collaborations. Feel free to reach out through any of the channels below.También hablo Español!

Typically respond within 24 hours