WP Manifestindependent plugin directory
manifest / ai / wp-rag-plugin

Simple RAG Search

(Vibe Coded) A simple WordPress plugin called "Simple RAG Search" that implements Retrieval-Augmented Generation for site content, using local AI models for testing/development (via Ollama or LM Studio's local API, both of which expose OpenAI-compatible endpoints).

by Simple RAG Search · github.com/jethrolanda/wp-rag-plugin

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/jethrolanda/wp-rag-plugin/archive/refs/heads/main.zip

Retrieval-Augmented Generation (RAG) over your WordPress posts and pages, using local AI (Ollama or LM Studio) or any OpenAI-compatible API.

Quick start

1. Install and activate

  • Copy this folder to wp-content/plugins/simple-rag-search/
  • In Plugins, activate Simple RAG Search

On activation, the plugin creates the {prefix}rag_chunks table. Deactivating the plugin does not remove indexed data.

2. Run a local AI server

Ollama (default settings)

ollama serve
ollama pull nomic-embed-text
ollama pull llama3.1

LM Studio

  1. Load an embedding model and a chat model in LM Studio.
  2. Start the local server (default http://localhost:1234).

3. Configure the plugin

Go to Settings → RAG Search:

Setting Ollama example LM Studio example
API style Ollama OpenAI-compatible
API base URL http://localhost:11434 http://localhost:1234/v1
Embedding model nomic-embed-text Your loaded embedding model ID
Chat model llama3.1 Your loaded chat model ID

Click Save Changes, then Test connection. If that succeeds, click Re-index all posts and wait for the progress bar to finish.

New and updated published posts and pages are indexed automatically when you save them.

4. Add search to the site

Put this shortcode on any page or post:

[rag_search]

Visitors can ask questions; answers are generated from your indexed content.

5. REST API (optional)

POST /wp-json/rag/v1/ask
Content-Type: application/json

{"query": "What services do you offer?"}

Response:

{
  "answer": "...",
  "sources": [
    { "post_id": 1, "title": "...", "url": "...", "score": 0.82, "chunk_id": 3 }
  ]
}

Troubleshooting

  • Connection test fails — Confirm Ollama or LM Studio is running and the base URL matches your setup. WordPress must be able to reach localhost from the PHP process (Studio/local sites usually can).
  • The AI says it does not know / answers feel empty — The index only contains text from published posts and pages. A page that only has the [rag_search] shortcode is not useful content (the plugin skips very short pages). Ask questions about your posts (e.g. “Hello world” body text), run Re-index all posts, and check that Stored chunks is greater than zero on the settings screen.
  • Empty or “no indexed content” answers — Run Re-index all posts or publish/update content with the AI server running.
  • Slow indexing — Each chunk calls the embedding model once; large sites take time. Bulk re-index runs in small batches from the admin UI.

Switching to a hosted API

Set API style to OpenAI-compatible, set the base URL (e.g. https://api.openai.com/v1), enter your API key, and set embedding/chat model names to match your provider. No code changes required.