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.comI. 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
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
Real designer queries collected and parsed
Schema-validated Algolia JSON with zero malformed responses
Average AI + Algolia end-to-end latency
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.
