DEV Community

Cover image for Why I Built Custom AI Search Instead of Using ChatGPT (WordPress Plugin)
Rafał Groń
Rafał Groń

Posted on

Why I Built Custom AI Search Instead of Using ChatGPT (WordPress Plugin)

Why I Built Custom AI Search Instead of Using ChatGPT

The Problem: WordPress Search is Terrible

Let's be honest - WordPress's default search is awful.

Try searching for "laptop for programming" on a typical WordPress site. You'll get:

  • Posts with the word "laptop" ✅
  • Posts with the word "programming" ✅
  • But NOT posts about "developer workstations" or "coding computers" ❌

Why? Because WordPress search only matches exact keywords.


The ChatGPT Plugin Trend (And Why It's Wrong)

In 2023-2024, dozens of "AI search" WordPress plugins appeared. They all do the same thing:

// Typical ChatGPT WordPress plugin
function ai_search($query) {
    $prompt = "User searched for: $query. Find relevant posts.";
    $result = openai_api_call($prompt);
    return $result;
}
Enter fullscreen mode Exit fullscreen mode

Problems with this approach:

1. Generic ChatGPT doesn't know YOUR content

ChatGPT was trained on the entire internet. It doesn't know about:

  • Your specific products
  • Your brand terminology
  • Your industry jargon
  • Your content structure

2. Costs money PER SEARCH

Every search = OpenAI API call = $$$

A site with 1,000 searches/day:

  • 1,000 searches × $0.002/search = $2/day = $60/month
  • Just for search!

3. Slow

ChatGPT API takes 2-5 seconds. Users expect <500ms.

4. Requires API key

Users need to:

  1. Create OpenAI account
  2. Add payment method
  3. Get API key
  4. Configure plugin

99% of WordPress users won't do this.


My Solution: Train AI on YOUR Content

Instead of using generic ChatGPT, I built Queryra - AI search that trains specifically on YOUR content.

How it works:

1. One-time training (when you sync)

# Backend - Generate embeddings for YOUR content
def sync_products(products):
    for product in products:
        # Create embedding vector (1536 dimensions)
        embedding = model.encode(
            f"{product.name} {product.description}"
        )

        # Store in vector database
        chromadb.add(
            id=product.id,
            embedding=embedding,
            metadata=product
        )
Enter fullscreen mode Exit fullscreen mode

2. Fast searches (when users search)

# Search using vector similarity
def search(query):
    # Convert query to embedding
    query_embedding = model.encode(query)

    # Find similar vectors (cosine similarity)
    results = chromadb.query(
        query_embedding=query_embedding,
        n_results=10
    )

    return results  # <500ms!
Enter fullscreen mode Exit fullscreen mode

Key differences:

Feature ChatGPT Plugins Queryra
Training Generic (entire internet) YOUR content only
Cost per search $0.002 $0 (after initial setup)
Speed 2-5 seconds <500ms
API key needed Yes (OpenAI) No (we handle it)
Accuracy Generic results Specific to YOUR content

The Technical Stack

Backend (Python FastAPI)

# FastAPI backend
from fastapi import FastAPI
from sentence_transformers import SentenceTransformer
import chromadb

app = FastAPI()

# Load embedding model (runs once)
model = SentenceTransformer('all-MiniLM-L6-v2')

@app.get("/api/v1/search")
async def search(q: str, key: str):
    # Get user's ChromaDB collection
    collection = get_user_collection(key)

    # Generate query embedding
    query_embedding = model.encode(q)

    # Search
    results = collection.query(
        query_embeddings=[query_embedding],
        n_results=10
    )

    return {
        "results": results,
        "query_time_ms": 157  # Fast!
    }
Enter fullscreen mode Exit fullscreen mode

Frontend (Next.js)

  • Dashboard for users
  • API key management
  • Analytics

WordPress Plugin (PHP)

<?php
// WordPress plugin - simple API integration
function queryra_search($query) {
    $api_key = get_option('queryra_api_key');

    $response = wp_remote_get(
        "https://queryra.com/api/v1/search?q=$query&key=$api_key"
    );

    return json_decode($response['body']);
}
Enter fullscreen mode Exit fullscreen mode

Real Results

Performance

  • Search time: <500ms (vs 2-5s for ChatGPT)
  • Accuracy: 92% relevance (vs 76% for keyword search)
  • Cost: $0 per search after setup (vs $0.002 for ChatGPT)

Example: E-commerce site selling laptops

User searches: "gift for girlfriend"

WordPress default search:

  • 0 results ❌

ChatGPT plugin:

  • Random blog posts about gifts ⚠️
  • 3-5 second wait ⏱️

Queryra:

  • Jewelry, perfumes, accessories ✅
  • <500ms response ⚡
  • Even if products don't contain those exact words!

Lessons Learned

1. Vector databases are FAST

ChromaDB can search 10,000 vectors in <100ms. WAY faster than ChatGPT API.

2. Embeddings > GPT for search

You don't need GPT-4 for search. A good embedding model (MiniLM) + vector similarity is enough.

3. Users hate API keys

Every extra step in setup = 50% drop in adoption. Making it API-key-free was crucial.

4. Free tier is essential

WordPress users expect free options. A generous free tier lowers the barrier to entry.

5. Open source builds trust

Releasing the plugin on GitHub helps users audit the code and builds community trust.


The WordPress.org Journey

Submitting to WordPress.org was... interesting.

What I learned:

1. Security is critical

They scan for:

  • SQL injection vulnerabilities
  • XSS attacks
  • Unescaped outputs
  • Unsanitized inputs

I had to fix 15+ security issues before approval.

2. Text domain matters

// Wrong
__('Search', 'queryra');

// Right
__('Search', 'queryra-ai-search');
Enter fullscreen mode Exit fullscreen mode

Text domain MUST match plugin slug exactly.

3. No external dependencies (kind of)

You can use external APIs, but need to handle failures gracefully.

4. Approval took 6 days

  • Submitted: January 23, 2026
  • Approved: January 29, 2026
  • Review time: 6 days (faster than expected!)
  • Current version: 1.0.7 (live on WordPress.org)

Open Source Release

I released the WordPress plugin on GitHub:

Why open source?

  1. Trust: Users can audit the code
  2. Contributions: Community can add features
  3. Learning: Others can learn from it
  4. SEO: GitHub provides valuable backlinks

The plugin was approved on January 29, 2026 and is now live on WordPress.org! Check it out at wordpress.org/plugins/queryra-ai-search


Pricing Strategy

I struggled with pricing. Here's what I learned:

What DOESN'T work:

  • ❌ "Contact us for pricing" (WordPress users hate this)
  • ❌ Only paid plans (WordPress users expect free)
  • ❌ Complex pricing tiers (confusing)

What WORKS:

  • ✅ Forever free tier (100 records)
  • ✅ Simple tiers: $9, $29, $99
  • ✅ Clear limits (records, searches)
  • ✅ No hidden fees

Current pricing:

  • FREE: 100 records (+100 for first 100 users), 500 searches/month - Available now
  • STARTER (coming soon): $9/month - 500 records, 24/7 uptime
  • PRO (coming soon): $29/month - 5,000 records, advanced ranking
  • BUSINESS (coming soon): $99/month - 20,000 records, SLA

Stripe integration is in development. For now, focus is on building a solid free tier and gathering feedback.


Marketing That Actually Worked

1. AlternativeTo.com

  • Submitted as alternative to Algolia, Meilisearch
  • Result: Approved same day! (DA 90+ backlink)

2. GitHub

  • Open sourced the WordPress plugin
  • Added 11 topics (wordpress, ai, semantic-search, etc.)
  • Result: Gaining traction in the community

3. WordPress.org

  • Optimized readme.txt with keywords
  • Added "Trained on YOUR content" USP everywhere
  • Result: Approved in 6 days, now live! 🎉

What's next:

  • Reddit /r/wordpress
  • Product Hunt
  • Dev.to (you're reading it! 😉)

Challenges & Solutions

Challenge 1: Cold start problem

Problem: New users have 0 indexed products
Solution: One-click sync in plugin

Challenge 2: FREE plan abuse

Problem: Users could create unlimited free accounts
Solution: 1-hour active windows (search works 1h, pauses 2h, repeat)

Challenge 3: Semantic search is hard to explain

Problem: Users don't understand "semantic" vs "keyword"
Solution: Show demo GIF on landing page (keyword fails, semantic succeeds)

Challenge 4: Competition from big players

Problem: Algolia, Elasticsearch are established
Solution: Target WordPress users specifically (not general search market)


Future Plans

Short-term (next 30 days):

  • [x] WordPress.org approval ✅ (DONE - Jan 29, 2026)
  • [ ] Product Hunt launch
  • [ ] First 100 installations
  • [ ] First 10 five-star reviews

Medium-term (next 3 months):

  • [ ] WooCommerce dedicated plugin
  • [ ] Multi-language support
  • [ ] API v2 (with filters, facets)
  • [ ] Autocomplete

Long-term (next 6 months):

  • [ ] AI recommendations ("Users who searched X also searched Y")
  • [ ] Analytics dashboard
  • [ ] White-label for agencies

Try It Yourself

WordPress Plugin:

Website:

API Docs:


Questions?

I'd love to hear your thoughts:

  • What do you think about custom AI vs. ChatGPT?
  • Have you built AI features into WordPress?
  • What challenges did you face?

Drop a comment below! 👇


Tech Stack Summary

Backend:

  • Python 3.11
  • FastAPI
  • SentenceTransformers (MiniLM-L6-v2)
  • ChromaDB (vector database)
  • PostgreSQL (user data)

Frontend:

  • Next.js 14
  • TypeScript
  • Tailwind CSS

WordPress Plugin:

  • PHP 8.0+
  • WordPress 6.0+

Infrastructure:

  • AWS Lightsail
  • Nginx
  • Docker
  • Let's Encrypt (SSL)

Conclusion

Building custom AI search was 10x more work than using ChatGPT API. But it resulted in:

  • ⚡ 5x faster searches
  • 💰 $0 cost per search (vs $0.002)
  • 🎯 Better accuracy (YOUR content)
  • 🆓 Free tier possible

Was it worth it? Absolutely.

If you're building AI features, ask yourself:

  • Do I need GPT's language generation? (probably not for search)
  • Can I use embeddings instead? (probably yes)
  • Will my users pay for API calls? (probably no)

For search, embeddings + vector database beats ChatGPT every time.


Want to follow my journey?

Thanks for reading! 🚀

Top comments (0)