HelloZeroNet / HelloZeroNet/ZeroNet

Support virtual sqlite3 tables in dbschema.json

Open
#1,456 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
18.8k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.