Manuscript Offprint

arXiv:2608.24060

SQLite is Enough. Lexical, Semantic, and Hybrid Search with scrydb

Timo Breuer

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Timo Breuer 1^{1}

TH Köln – University of Applied Sciences, 50968 Köln, Germany

timobreuer@acm.org

Abstract. This work introduces scrydb, a Python library that enables lexical, semantic, and hybrid search within SQLite. For lexical search, scrydb leverages SQLite's full-text search extension FTS5. Semantic search builds on sqlite-vec, a SQLite extension for vector search. Furthermore, the library allows users to rerank and fuse retrieval results to combine both lexical and semantic approaches, providing a lightweight solution for downstream tasks in information retrieval (IR) or agentic search. We evaluate scrydb on various IR benchmark datasets and demonstrate its effectiveness in text retrieval based on keyword matching, semantic similarity, and rank fusion. In addition, we provide insights into query latency and the trade-off between efficiency and effectiveness. scrydb is available under the MIT license.

https://github.com/breuert/scrydb/

Keywords: Semantic Search · Text Embeddings · Efficiency · SQLite.

1 Introduction

scrydb is built around the idea of packaging an entire small-to-medium-scale search pipeline and the corresponding resources, i.e., documents, lexical index, and embeddings, into an artifact that is as easy to share, archive, and rerun as a single file. It is a minimalist library for lexical, semantic, and hybrid search that stores everything a text retrieval component needs inside a single SQLite database file, with no server process, no external index, and no separate vector store to keep in sync. Lexical search is provided by SQLite's FTS5 extension and its BM25 ranking function [19]. Semantic search over the entire index is enabled by sqlite-vec, a SQLite extension for vector search at different levels of precision. For instance, binary embeddings enable efficient search, while results can also be retrieved with full-precision embeddings at the cost of increased query latency. The retrieved first-stage candidates can optionally be reranked using more costly approaches, e.g., with full-precision embeddings and cosine similarity. Alternatively, the full embeddings can be discarded to keep disk usage low. Additionally, hybrid search allows fusing the lexical and semantic rankings via Reciprocal Rank Fusion (RRF) [7].

The core contributions of this work are as follows:

T. Breuer

– Lexical, semantic, and hybrid search with SQLite. scrydb implements lexical scoring, semantic scoring, second-stage reranking, and rank fusion in a single library, rather than requiring application-level orchestration across multiple systems.

– Single-file reproducibility with an archival-grade storage format. By colocating raw documents, the lexical index, and embeddings in one SQLite file, scrydb reduces an entire IR resource to a single artifact: one file to share it all, rather than a bundle of index dumps, vector-store snapshots, and configuration files. Consequently, a scrydb database inherits the long-term preservation properties of any other archival dataset.

– Experimental evaluation of effectiveness and efficiency. We evaluate scrydb on a range of BEIR datasets [22], comparing it to MTEB baseline results [16]. Specifically, the experiments shed light on query latency and on the effectiveness of different retrieval pipelines and levels of vector precision, providing insights into the trade-offs between retrieval quality and resource requirements.

– Reusable resources for follow-up research. scrydb is an open-source Python library released under the MIT license, allowing others to build on it. Additionally, we provide prebuilt scrydb databases for the evaluated datasets, including embeddings computed with Qwen3-Embedding-8B [26], and the final retrieval runs used in our evaluation, so that future work can reproduce our results or use them as baselines for comparison. 1^{1}

References (26)