--- id: sqlite-fts4 version: "1.0.3" license: Apache License, Version 2.0 license_treatment: permissive maintenance: abandoned --- # sqlite-fts4 — Python functions for working with SQLite FTS4 search License: permissive · Maintenance: abandoned · Downloads: 1.3M/mo ## What it is and what it does sqlite-fts4 is a Python module that registers custom SQL functions into SQLite to improve full-text search ranking and analysis. It provides four main functions: rank_score() implements a simple TF-IDF-based ranking, rank_bm25() implements the Okapi BM25 algorithm for relevance scoring, decode_matchinfo() converts SQLite's binary matchinfo output into human-readable JSON integers, and annotate_matchinfo() produces a verbose JSON structure explaining what each value in matchinfo means. You use it by importing the module, calling register_functions() on a SQLite connection, and then invoking the functions in your FTS4 queries via SQL. It has no runtime dependencies and installs as a pure Python wheel, making it lightweight to add to projects that already use SQLite and FTS4 for search. The package is designed for developers building search features on top of SQLite's full-text indexing. Use it for: - Rank full-text search results by relevance using BM25 scoring in a SQLite-backed application. - Convert opaque SQLite matchinfo binary output into readable JSON for debugging or analysis. - Implement TF-IDF-based document ranking without external search infrastructure. - Annotate matchinfo results to understand how SQLite calculated match statistics for each query. - Integrate search ranking into Datasette via the datasette-sqlite-fts4 plugin. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Registers custom SQLite functions for ranking and analyzing FTS4 full-text search results, including BM25 scoring, TF-IDF ranking, and matchinfo decoding. Yes, if you are already using SQLite FTS4 and need ranking functions—it is lightweight, dependency-free, and permissively licensed. However, the package is abandoned (last update 2022-07-30) and has no active maintenance, so expect no updates for bugs or compatibility issues with future Python versions. Suitable for stable, self-contained projects; risky for long-term production systems requiring ongoing support. ## Install pip install sqlite-fts4 uv add sqlite-fts4 poetry add sqlite-fts4 ## Installing sqlite-fts4 Before you install: Installation is straightforward with no runtime dependencies. The package has not been updated since 2022-07-30 and is marked abandoned, so expect no active maintenance or bug fixes. License in practice: Licensed under Apache License 2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions. Quickstart: import sqlite3 from sqlite_fts4 import register_functions conn = sqlite3.connect(":memory:") register_functions(conn) # Now use rank_bm25(), rank_score(), decode_matchinfo(), or annotate_matchinfo() in SQL queries Requires an existing SQLite FTS4 table; the functions are SQL-side and work only with FTS4 indexed columns. Verify before relying: - Whether the package works correctly with current Python versions (support unspecified in metadata). - Whether the BM25 implementation matches current Okapi BM25 specifications or has known deviations. - Performance characteristics when used with large FTS4 indexes. ## Package facts - License: Apache License, Version 2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 1.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlite fts4 ranking functions, full-text search scoring, bm25 sqlite, fts4 relevance ranking, matchinfo decoder, search result ranking, sqlite search functions, search-ranking, sqlite-extension, fts4 [View on SkillFed](https://skillfed.io/packages/sqlite-fts4) · [View on PyPI](https://pypi.org/project/sqlite-fts4/)