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.
What is AI search, and how is it different from keyword search?
"AI search" covers three different things, and it helps to separate them before deciding what to build.
| Approach | How it matches | Good at | Weak at | Running cost |
|---|---|---|---|---|
| Keyword | Shared words, ranked by frequency | Names, product codes, exact phrases | Synonyms, questions phrased differently from your pages | Very low |
| Semantic | Meaning, through vector similarity | Natural questions, synonyms, other languages | Exact codes, rare names, new jargon | Low: one embedding per query plus a vector index |
| Hybrid | Both, merged into one ranking | Most real search boxes | Needs tuning of the blend | Low |
| AI answer | A model writes an answer from the top results | Questions with one answer spread across pages | Cost and wrong answers at scale | A 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?
- 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.
- Decide what to index. Which content types, which fields (title, body, tags, price, availability), and what filters and access rules each result carries.
- Chunk and embed the content, storing each vector next to the record it came from.
- Run hybrid search: keyword and vector queries together, merged into one ranking.
- 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.
- Ship to a share of visitors and compare zero-result rate, clicks on results, and searches that end in an enquiry or a purchase.
- 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?