HelloZeroNet / HelloZeroNet/ZeroNet

Support virtual sqlite3 tables in dbschema.json

オープン
#1,456 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
18.8k
フォーク
2.3k
PR マージ指標
30日以内にマージされた PR はありません

説明

Sqlite has two very useful extensions: [Full Text Search](https://www.sqlite.org/fts5.html) and [Spellfix search](https://www.sqlite.org/spellfix1.html) that could make searching on Zites more meaningful and very fast.

Looking briefly at files in `src/Db`, I think that it would be a very short change to enable virtual tables: One could just modify a couple of lines in the function [`createTable@DbCursor.py`](https://github.com/HelloZeroNet/ZeroNet/blob/master/src/Db/DbCursor.py#L106-L114).

So a new virtual table using fts5 could be defined as
```
"fts_posts": {
"virtual": true,
"payload": fts5(title, body, uuid UNINDEXED)",
"schema_changed": 1
}
```
that would be translated into `CREATE VIRTUAL TABLE fts_posts USING fts5(title, body, uuid UNINDEXED)`. Update and delete queries works as in a standard table.

It is indeed true that such extensions are optional, but since ZeroNet ships with its built version of sqlite3 I think we can make sure such extensions are enabled.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

src/Db/DbCursor.py の createTable から始め、dbschema.json のエントリがどのようにその関数へ到達するかを追跡します。バンドルされた SQLite ビルドが仮想テーブル拡張をどのように処理するかを確認し、提案されたスキーマが、更新および削除操作を含め、意図した CREATE VIRTUAL TABLE の動作を生成することを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, sqlite
領域
databases
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。