How to add AI search to your website or product

AI search combines keyword and semantic search, with an optional AI answer on top. How to add it, what it costs and when keyword search is enough.

By Sohail Hussain17 November 20266 min read

To add AI search to a website or product, keep your keyword search and add semantic search alongside it. Semantic search converts your content and each query into vectors with an embedding model, so it finds results by meaning rather than shared words. Run both for every query, merge the two lists into one ranking, and measure the result against real queries from your logs. An AI-written answer above the results is a separate, optional layer. It costs more per search and can be wrong, so add it last, and only where people search for answers rather than items.

Most of the improvement comes from hybrid ranking. This guide covers how it works, how to add it step by step, the running cost as of October 2026, and when ordinary keyword search is enough.

"AI search" covers three different things, and it helps to separate them before deciding what to build.

ApproachHow it matchesGood atWeak atRunning cost
KeywordShared words, ranked by frequencyNames, product codes, exact phrasesSynonyms, questions phrased differently from your pagesVery low
SemanticMeaning, through vector similarityNatural questions, synonyms, other languagesExact codes, rare names, new jargonLow: one embedding per query plus a vector index
HybridBoth, merged into one rankingMost real search boxesNeeds tuning of the blendLow
AI answerA model writes an answer from the top resultsQuestions with one answer spread across pagesCost and wrong answers at scaleA model call per search

Someone typing "stop laptop overheating" into a shop that sells "cooling pads" gets nothing from keyword search and the right products from semantic search. Someone typing "CP-2040" wants the exact product with that code, which keyword search finds and semantic search may not. That is why hybrid wins: real search boxes get both kinds of query.

We add this as part of our AI product features work, alongside chat over your data and content generation. It is one of the product-side tasks in the wider picture of AI workflow automation.

How does semantic search work under the hood?

Long content is split into passages of a few hundred words. An embedding model turns each passage into a vector, a list of numbers that places it in a space where similar meanings sit close together. The vectors are stored in an index: the pgvector extension adds this to PostgreSQL, and most search engines now support vectors too. At search time the query is embedded the same way and the index returns the nearest passages.

Three details decide whether it works well:

  • Passage size. Too long and a passage covers several topics, so it matches everything weakly. Too short and it loses context. The RAG chunk size calculator shows how settings translate into chunk counts and embedding cost.
  • Merging. A simple, reliable way to merge keyword and vector results is reciprocal rank fusion: each result scores by its position in each list, and the scores are added. It needs no tuning to start.
  • Filters and permissions. Language, category, stock status and who may see a result belong in the query itself, not applied afterwards. Filtering after retrieval can leave a user with three results out of the ten you fetched, or with private results leaking through.

An optional reranking step sends the top 30 to 50 results to a reranking model that reorders them more carefully. It adds cost and a little latency. Add it only if your test set shows the right result often sits at position 6 instead of 1.

RAG explained covers the same retrieval machinery from the angle of chatbots that answer from your documents.

How do you add it, step by step?

  1. Read your search logs. The top 100 queries, the queries that return nothing, and the queries people rephrase straight away. This list tells you what is broken and becomes your test set.
  2. Decide what to index. Which content types, which fields (title, body, tags, price, availability), and what filters and access rules each result carries.
  3. Chunk and embed the content, storing each vector next to the record it came from.
  4. Run hybrid search: keyword and vector queries together, merged into one ranking.
  5. Build a test set of 50 real queries with the result that should come first. Measure how often it lands in the top three, for the old search and the new one.
  6. Ship to a share of visitors and compare zero-result rate, clicks on results, and searches that end in an enquiry or a purchase.
  7. Keep the index fresh. Re-embed content when it changes. If you switch embedding models, re-embed everything: vectors from different models cannot be compared.

Should search show an AI-written answer?

Only where people search for answers. A help centre, product documentation, a policy library or a knowledge base suits a generated answer with citations: the question "can I return a sale item after 30 days" has one answer, and it may be spread across two pages. A product catalogue does not. People searching a shop want to see and compare items, and a paragraph above them gets in the way.

If you add answers, four rules keep them safe:

  • Answer only when the top results score well. Otherwise show results without an answer.
  • Cite the pages the answer came from, so readers can check.
  • Allow "I could not find this" as an answer.
  • Cache answers to frequent queries, which cuts cost and keeps them consistent.

A wrong answer shown above the right results does more harm than no answer. How to stop an AI making things up covers the grounding techniques. If your users want to ask questions over their own records rather than your public content, that is a different build: chat with your data.

What does AI search cost to run?

Embeddings are cheap. As of October 2026, OpenAI's text-embedding-3-small costs $0.02 per million tokens, according to its pricing page. A site of 5,000 pages at about 1,000 tokens each is 5 million tokens, about $0.10 to embed in full. Queries are a few tokens each, so 100,000 searches cost a few cents. Storage is usually the larger line: free inside a PostgreSQL database you already run, or a monthly fee for a managed vector database.

AI answers are where the money goes. Say each answer sends 3,000 input tokens (instructions plus the top passages) and returns 300, for 50,000 searches a month. At list prices as of October 2026, that is about $22.50 a month on GPT-6 Luna, about $170 on Gemini 3.8 Flash and about $450 on Claude Sonnet 5.5. The AI API cost calculator runs your own figures. Caching frequent answers and answering only confident results can halve those numbers.

The build is a few weeks of work for most sites. A larger catalogue with many filters and languages takes longer, mostly in the testing.

When is keyword search enough?

On small sites. Under a few hundred pages, most visitors use the navigation, and search handles a handful of queries a day. Improve the navigation first.

When people search by name or code. Parts suppliers, catalogues searched by SKU, and directories searched by name are served well by keyword search with typo tolerance.

When the basics are missing. Many "search does not work" complaints come from missing synonyms, no typo tolerance, or products that do not use the words customers use. A synonym list and better product titles fix those for a fraction of the cost.

When the logs look healthy. If few searches return nothing and most end in a click, the gain from AI search is small.

The search logs answer this for you. Export a month of queries, look at the zero-result list, and decide from that whether the problem is meaning, missing content or missing synonyms.

Was this guide useful?

Questions

Frequently asked.

Does better site search help SEO?

Not directly. Search inside your site helps visitors who are already there; it does not change how Google ranks your pages. Its logs are useful for SEO, though. They show the words customers actually use, which often differ from the words on your pages, and those are worth putting in titles and headings.

Can AI search look inside PDFs and documents?

Yes. Extract the text, split it into passages and index those passages like any other content, with a link back to the file and page. Scanned PDFs need a text extraction step first, either OCR or a vision-capable model. Keep the documents' access rules attached to each passage so private files never appear in public results.

Does semantic search work for Arabic and other languages?

Multilingual embedding models handle Arabic, Hindi and most major languages, and can match a query in one language to content in another. Keyword search for Arabic needs proper normalisation of letter forms and diacritics to work well. Test with real queries in each language you support.

Sohail Hussain

Founder, MSH Technologies

Sohail has designed and built websites, web apps and AI products for over 12 years, for clients from Singapore-based industrial groups to early-stage SaaS startups. He writes about what actually worked.

Keep reading

Related guides.

All posts

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

Sohail, Founder, replies within 1 working day (Mon–Sat, IST). Free and no obligation.