---
title: "Building a code search engine with Turso"
description: "Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search."
url: "https://swe.quest/articles/building-a-code-search-engine-with-turso-6a98c3f86064a46b"
canonical: "https://turso.tech/blog/building-a-code-search-engine-with-turso"
source: "Turso"
published: "2026-02-26"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["vector-search","search","sqlite","ai-agents","rag"]
---

# Building a code search engine with Turso

A post on [Turso](https://swe.quest/sources/turso.md), published 2026-02-26, 6 min read, How-to. Original: [https://turso.tech/blog/building-a-code-search-engine-with-turso](https://turso.tech/blog/building-a-code-search-engine-with-turso)

## Summary

Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search. Tree-sitter splits code into function and struct chunks, which are embedded locally with all-MiniLM-L6-v2 and stored as int8-quantized vector8(384) columns (395 vs 1,536 bytes per vector). Brute-force cosine search over 40,000 TypeScript compiler chunks takes about 240ms on an M2, and BM25 keyword search with name/signature weights takes 1-4ms. Results are merged with Reciprocal Rank Fusion (0.6 vector, 0.4 FTS), and a TypeScript SDK accepts any embedding function and indexes incrementally by file hash.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)

## Prerequisites

- text embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- cosine similarity

## Keywords

Turso, codemogger, tree-sitter, all-MiniLM-L6-v2, Reciprocal Rank Fusion, BM25, MCP

## Related posts

- [Building a Retrieval Pipeline with Turso and Voyage AI](https://swe.quest/articles/building-a-retrieval-pipeline-with-turso-and-voyage-ai-d56063c4fe3f313b.md): Turso · 2026-07-15 · Medium · 10 min read · RAG & retrieval, Vector search, SQLite, AI agents, LLMs
  Turso's SQLite-compatible engine with native vector columns, paired with Voyage AI embedding and reranking models, replaces a multi-service RAG stack with a single embeddable database for agent retrieval and memory.
- [How Hugging Face Inference Endpoints, Jobs, and Buckets Power Search on Papers with Code](https://swe.quest/articles/how-hugging-face-inference-endpoints-jobs-and-buckets-power-search-on-papers-ac5d7c4e21a2638e.md): Hugging Face · 2026-08-21 · Medium · 10 min read · Search, Vector search, PostgreSQL, Inference & serving, Data pipelines
  Papers with Code search combines PostgreSQL full-text search with pgvector semantic search over Qwen3-Embedding-0.6B vectors, fused by weighted reciprocal rank fusion (k=60), with exact-title, arXiv-ID and navigational matches pinned on top.
- [Local RAG with Ollama, Mistral, and Turso](https://swe.quest/articles/local-rag-with-ollama-mistral-and-turso-c9414cc4e6a29ef6.md): Turso · 2025-01-08 · Medium · 8 min read · RAG & retrieval, Vector search, SQLite, Local-first & sync, TypeScript
  A local retrieval-augmented generation pipeline can be built in TypeScript using Ollama's Mistral model for both embeddings and generation, with libSQL storing documents and 4096-dimension F32\_BLOB vectors in a single SQLite file indexed via libsql\_vector\_idx.
- [How to Generate & Store OpenAI Vector Embeddings with Turso](https://swe.quest/articles/how-to-generate-store-openai-vector-embeddings-with-turso-1144f075a7bcad32.md): Turso · 2024-07-01 · Medium · 5 min read · Vector search, SQLite, LLMs, JavaScript
  Turso's beta vector support stores OpenAI text-embedding-ada-002 embeddings in a libSQL F32\_BLOB(1536) column, whose size matches the model's 1536 dimensions.
- [Building AI Agents That Remember with Mastra and Turso Vector](https://swe.quest/articles/building-ai-agents-that-remember-with-mastra-and-turso-vector-cf9403520a15ae02.md): Turso · 2025-06-11 · Medium · 12 min read · AI agents, RAG & retrieval, Vector search, SQLite, TypeScript
  Mastra, a TypeScript AI agent framework, can use Turso's libSQL (a SQLite fork with native vector search) as a single database for agent memory, telemetry and vector embeddings.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
