---
title: "Smart search features"
url: "https://zuey.me/articles/tinh-nang-tim-kiem-thong-minh?lang=en"
locale: en
access: members
full_text: false
published_at: "2025-05-20T01:04:30.000Z"
tags: ["AI"]
translations:
  vi: "https://zuey.me/articles/tinh-nang-tim-kiem-thong-minh.md?lang=vi"
  zh: "https://zuey.me/articles/tinh-nang-tim-kiem-thong-minh.md?lang=zh"
  ko: "https://zuey.me/articles/tinh-nang-tim-kiem-thong-minh.md?lang=ko"
  ja: "https://zuey.me/articles/tinh-nang-tim-kiem-thong-minh.md?lang=ja"
---
# Smart search features

> Users are less patient these days and more used to "asking questions" than typing keywords. I tried 2 ways to build smart search for a website: LLM keyword extraction and RAG with ColiVara, each with its own pros and cons.

> **INFO:** **TL;DR:** RAG gives way more accurate results, but it costs more and is a bigger headache. For small projects, just use an off-the-shelf search (Algolia, Meilisearch,...) + an LLM API: fast & cheap.

### Every website really needs "smart search"

User behavior has clearly changed a lot: first, people are less patient; second, they're getting used to "asking a question & getting an answer" rather than "searching by keywords".

So I believe "smart search" is a must-have for a website, a place where users can "ask questions" to your website.

I came up with 2 ways to implement this, and after trying them out, each one has its own pros and cons:

### Approach 1: Extract keywords with an LLM

Super simple. It's still the usual search feature, but when a user asks a question, we use an LLM to analyze it and extract keywords, then search as usual by calling the API with those keywords. Once we have results, we feed them back to the LLM so it can explain them. That's it.

```mermaid
flowchart LR
  A["User question"] --> B["LLM extracts keywords"]
  B --> C["Search API via ElasticSearch or OpenSearch"]
  C --> D["Search results"]
  D --> E["LLM explains the answer"]
```

*How approach 1 works*

If you want it fast, add ElasticSearch (or OpenSearch) here to speed up search many times over.

The upside is that it's fast & costs almost nothing extra, unless your database is large & query volume is high, in which case you'll pay $ for ElasticSearch (or $ for a VPS if you use OpenSearch).

However, this approach has some limits. For example, if you ask "products under $10", extracting keywords won't find the right results, and getting it right means writing extra filter functions in the API, which is pretty annoying.

---

*Phần còn lại dành cho thành viên có quyền đọc toàn bài (Knowledges, Kết hợp, Cộng đồng) — see plans at https://zuey.me/pricing*
