How-to

Adding AI Search to Your Website: Replace Your Search Box with Sourced Answers

The Kopik team8 min read

Swapping a traditional search box for an AI site search means a visitor types a real question and gets a direct answer with a citation back to the page or document it came from, instead of ten blue links to click through one by one. The technical change is smaller than it sounds: you keep your existing content, add a retrieval layer that understands meaning as well as keywords, and expose it through a simple API call or embedded widget. Done well, it cuts support tickets, keeps people on the page longer, and surfaces content that keyword search alone would have buried.

Why the classic search box is losing people

Most on-site search boxes are still built on keyword matching. They work when a visitor types the exact words used on the page, and they fall apart the moment someone phrases things naturally: a different tense, a synonym, a question rather than a noun phrase, or a query that spans two documents. For a UK business, that gap matters more than it used to, because people increasingly type questions the way they would ask ChatGPT, not the way they would type into a 2015 search box.

  • Zero-result pages for queries that are actually answered somewhere on the site, just in different wording
  • Visitors forced to open several results and read each one to find the relevant paragraph
  • No way to ask a follow-up question without starting a new search
  • Search results that rank by keyword frequency rather than by relevance to the actual question
  • No visibility into what people are failing to find, beyond a raw list of search terms

The fix is not a better keyword index. It is retrieval that understands synonyms and intent, combined with a layer that reads the retrieved passages and writes a direct answer. For a longer explanation of how meaning-based matching differs from keyword matching, see Semantic Search Explained.

What an answer engine actually does differently

An AI site search, sometimes called an answer engine, is not just a search index with a chat window bolted on. Under the hood it typically combines two retrieval methods, full-text (keyword) search and vector (semantic) search, then feeds the best-matching passages to a model that drafts an answer grounded in that exact text. The strongest implementations use hybrid search rather than relying on vectors alone, because exact terms, product codes, and section numbers still matter and pure semantic matching can miss them. We cover the mechanics of this in Hybrid Search: Why BM25 Plus Vectors Beats Either Alone for RAG.

The practical difference for a visitor is simple: instead of a results list, they get a short answer in plain English with a link or quoted excerpt pointing to the source page. Instead of a chatbot that makes things up when it does not know, a well-built answer engine refuses to answer, or says so explicitly, when nothing in the content supports a claim.

The API integration approach

You do not need to retrain a model or run your own infrastructure to add this to a website. The usual pattern is to index your content once into a knowledge base, then query it from your front end through a REST API, returning either a grounded answer with citations or the raw matching passages ("passages" mode) if you prefer to control the presentation yourself.

  1. Gather the source content: help articles, product pages, policy documents, PDFs, FAQs, past support replies
  2. Index it once into a searchable knowledge base rather than relying on your CMS's built-in search
  3. Expose a query endpoint that your search box calls instead of (or alongside) your existing search index
  4. Render the answer with its citation, and keep a fallback to a traditional results list for queries the system cannot answer confidently
  5. Log every query and answer so you can audit quality and spot content gaps

Kopik handles steps two and three directly: you upload documents (PDF, Word, text, Markdown) to a knowledge base, it extracts, chunks and indexes them for hybrid search, and you query it through a REST API with an API key, or through an MCP server if you want Claude, Cursor, ChatGPT or another MCP client to search your content too. If you are integrating this into an existing product rather than a marketing site, our developer-focused walkthrough Adding a Knowledge Base API to Your App: A Developer's Guide covers authentication, rate limits and response shapes in more detail.

Public or private base?

If the content you are indexing is genuinely useful outside your own site (a specialist glossary, a regulatory summary, detailed product documentation), you can list the base publicly in the catalogue and charge per question while still using it privately on your own site via API. Private bases are restricted to you and your API keys only.

Building it in practice: a short implementation path

The fastest route for a marketing or support site is usually a widget that replaces or sits alongside the existing search box, backed by a knowledge base you control entirely. Here is a realistic path for a small team:

  1. Export or collect your content (help centre articles, PDFs, policy pages, pricing pages) and clean up anything clearly outdated
  2. Create a knowledge base at /dashboard/bases/new and upload the documents
  3. Test the quality of answers directly on the website before wiring up any code, checking that citations point to the right passages
  4. Decide whether you want grounded answers (a written response plus sources) or passages only, depending on how much control you want over presentation
  5. Call the query endpoint from your search box using your API key, documented in full at /developers
  6. Add a visible
  7. Source: [page name]
  8. link under every answer, and a simple thumbs up or down for feedback
  9. Keep the old keyword search as a fallback tab for users who prefer browsing results

If your source material includes scanned PDFs, badly formatted exports or tables, the quality of the answers will depend heavily on how well the text was extracted before indexing. That is worth checking early rather than after launch; see Scanned Documents and OCR for AI: Why Extraction Quality Makes or Breaks RAG if any of your content started life as a scanned document.

Measuring results after launch

The point of replacing a search box is measurable, not just a nicer interface. Track a small set of numbers from day one so you can prove (or disprove) the change is working.

Metrics worth tracking

MetricWhat it tells youHow to measure
Zero-answer rateHow often the system has nothing to say, a proxy for content gapsLog queries where confidence is low or no passage was retrieved
Deflection rateWhether visitors stop opening a support ticket after getting an answerCompare ticket volume for pages with the widget enabled vs without
Citation click-throughWhether people trust the answer enough to check the sourceTrack clicks on the cited link under each answer
Thumbs up / down ratioDirect user feedback on answer usefulnessA simple feedback control under each answer
Average answer latencyWhether the experience feels instant or sluggishAPI response time logs
Cost per queryWhether the economics still make sense at volumeCredits consumed, or subscription usage gauge

Beyond raw usage numbers, it is worth periodically auditing a sample of answers for faithfulness: does the answer actually say what the cited passage says, and nothing more? Our guide How to Evaluate a RAG System: Retrieval Metrics, Faithfulness and Citation Accuracy sets out a method for this, and Document Q&A With Citations: How to Check an AI Answer gives a quick checklist your support team can run manually on flagged answers.

Pricing, freshness and governance

Two pricing models are common for this kind of feature: prepaid credits charged per question, or a flat monthly subscription with a usage gauge, which tends to suit sites with predictable traffic better than pay-as-you-go. Either way, budget for re-indexing whenever your underlying content changes meaningfully, not just at launch; stale documents behind a confident-sounding answer are worse than a visible "no results" message, because the visitor has no reason to doubt the answer.

If your site handles UK personal data (customer accounts, support tickets, HR content), check your data processing position before indexing anything sensitive; UK GDPR and RAG: What to Check Before You Build a Knowledge Base walks through the main points, including where documents are stored and who can query a private base.

Try it on your own content

Create a free knowledge base, upload a handful of your help articles or policy pages, and test the answers before you write a single line of integration code.

When a widget is not enough

For some teams the end goal is not a widget on the marketing site but an assistant usable from the tools people already work in. If your support or sales team want to query the same knowledge base from Claude, Cursor or ChatGPT while they work, rather than opening a browser tab, the MCP route covered in Connect Claude, Cursor or ChatGPT to a Knowledge Base uses the exact same underlying index, so you are not building two separate systems.

You can also browse existing public knowledge bases in the catalogue to see what good answer quality looks like in practice, including how citations are presented, before deciding how much of that pattern to replicate on your own site.

Frequently asked questions

Does AI site search replace the need for good on-page SEO and site structure?

No. The quality of an AI site search depends entirely on the quality and completeness of the underlying content. Well-structured, accurate pages still matter, the AI layer just makes that content easier to find and query directly rather than changing what content you need.

Will an AI search box hallucinate answers that are not in my content?

A properly grounded system should refuse to answer, or say it does not know, when nothing in your indexed content supports a claim, rather than inventing one. This is why citation display matters: it lets visitors (and you) verify every answer against a real source passage.

How long does it take to set up AI search on an existing website?

Indexing a moderate set of documents typically takes minutes once uploaded. The bulk of the time is usually spent gathering and cleaning the source content, and wiring the API call into your existing front end, which for a simple widget can often be done in a day or two.

Should I keep the old keyword search alongside the new AI search?

Yes, at least initially. Keeping a fallback tab or link to traditional results gives visitors who prefer browsing an option, and gives you a comparison point for measuring whether the AI answers are actually reducing support tickets and improving engagement.

Can I charge other people to query my knowledge base as well as using it on my own site?

Yes. A knowledge base can be public (listed in a catalogue, priced per question, with the creator keeping the majority of revenue) while also being queried privately from your own website through an API key, so the same content can serve both purposes.

Get the Kopik newsletter

New knowledge bases, RAG guides and product news. One email every week or two, unsubscribe in one click.

By subscribing you agree to receive our newsletter. We never share your address.