---
id: "willison-search-rag-build"
title: "Building search-based RAG with Datasette"
creator: "Simon Willison"
creator_url: "https://simonwillison.net/2024/Jun/21/search-based-rag/"
creator_x: "https://twitter.com/simonw"
url: "https://simonwillison.net/2024/Jun/21/search-based-rag/"
level: "intermediate"
level_max: null
category: "build-logs"
subcategory: "external-builds"
region: "West"
license: "closed"
license_scope: "linked-resource"
access: "free"
models: ["any"]
source_date: "2024-06-21"
date_added: "2026-10-18"
---

[Build logs](/build-logs/index.md)

# Building search-based RAG with Datasette

by [Simon Willison](https://simonwillison.net/2024/Jun/21/search-based-rag/) [@simonw](https://twitter.com/simonw)

[Read the original →](https://simonwillison.net/2024/Jun/21/search-based-rag/)

A real prototype log follows full-text retrieval through implementation, model changes and missing evals.

Willison records a live build that turns a question into search keywords, queries SQLite through Datasette and uses retrieved posts to answer. The account includes the annotated implementation and a model switch after keyword instructions failed. It explicitly stops short of production readiness because evaluation is missing; the dated APIs and hosted services need rechecking before reuse.

Level: [Intermediate](/levels/index.md#intermediate)
Models: any
Category: [Build logs](/build-logs/index.md)
Tags: [build-log](/tags/build-log/index.md)
Source date: 2024-06-21
Added: 2026-10-18
Last verified: 2026-10-18
Status: ok
Prerequisites: Following the annotated implementation requires SQL and JavaScript or TypeScript plus model API familiarity; no new retrieval research is assumed.
Subcategory: [external builds](/build-logs/external-builds/index.md)
Region: West
Original language: en
Access: free
Resource reuse: closed: No general open-reuse grant established for this article. Free reading access does not grant redistribution rights. [Facet definitions](/about/index.md#facets)

Summary in our own words. Rights remain with the original creator. [Credit and correction policy](/about/index.md#credit-policy).

[Plain-text Markdown copy](/build-logs/external-builds/willison-search-rag-build/index.md)
