跳到正文
DEV Community· Ai2th·· 6 天前AI 評分35

Miktam Bible 第 1 部分:以 SQLite、FTS5 和開放聖經資料實現離線優先

Miktam Bible | Part 1 — Offline-First: SQLite, FTS5 and Open Bible Data

AI 導讀

Miktam Bible 以 SQLite 儲存聖經內容,並用 FTS5 建立全文索引,讓用戶無須連接網絡即可閲讀和搜尋。KJV 隨應用程式附上,其他譯本可下載一次後離線使用;資料庫則公開於 GitHub,供他人使用。切換譯本時,標記、書籤和筆記仍會對應原有經文。

正文

Ai2th

"Offline" is easy to promise and hard to deliver. This part covers how Miktam Bible stores Scripture so that reading and searching never need the network.


🗄️ One translation, one SQLite file

Each translation is a standalone SQLite database with a simple schema:

CREATE TABLE books (
  book_number    INTEGER PRIMARY KEY,
  name           TEXT NOT NULL,
  abbreviation   TEXT NOT NULL,
  testament      TEXT NOT NULL CHECK (testament IN ('OT', 'NT')),
  total_chapters INTEGER NOT NULL
);

CREATE TABLE verses (
  id           INTEGER PRIMARY KEY AUTOINCREMENT,
  book_number  INTEGER NOT NULL,
  chapter      INTEGER NOT NULL,
  verse_number INTEGER NOT NULL,
  text         TEXT NOT NULL,
  UNIQUE (book_number, chapter, verse_number)
);

CREATE VIRTUAL TABLE verses_fts USING fts5(
  text, content=verses, content_rowid=id
);

The verses_fts table is SQLite's FTS5 full-text index. Searching the whole Bible is one indexed query, and it is instant on a phone.


📦 Download once, read forever

The King James Version ships inside the app, so Miktam Bible works the moment it is installed. Other translations are downloaded once from the Translations screen and then live on the phone like KJV.


🌍 The data is open

The databases are public on GitHub, so anyone can build on them:

Repo Contents
bible_db One SQLite file per translation
concordance_db Strong's Greek and Hebrew, lexicons, cross-references
bible_db_languages_a_f ~1,100 languages
bible_db_languages_g_m ~1,000 languages
bible_db_languages_n_s ~1,100 languages
bible_db_languages_t_z ~970 languages

🔗 Highlights that survive switching translations

Highlights, bookmarks and notes are stored against the canonical coordinates (book number, chapter, verse) rather than a row in one translation's table. Switch from KJV to another version and your highlights are still on the right verses.


Next, Part 2: the AI study assistant, and how it answers from Scripture without a server.

📥 Get Miktam Bible

Miktam Bible is in Google Play closed testing:

  1. Join the AI2TH Google Group with the Google account on your phone. Members are testers for every AI2TH Play app.
  2. Opt in at play.google.com/apps/testing/miktam.bible.
  3. Install from Google Play.

Different Play account? Request access here.

來源:DEV Community · dev.to