HelloZeroNet / HelloZeroNet/ZeroNet

Support virtual sqlite3 tables in dbschema.json

Aperta
#1,456 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
18.8k
Fork
2.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.