switch to fts5, rework search syncing

This commit is contained in:
nkanaev
2026-06-03 13:56:02 +01:00
parent 2f263e9803
commit 138b5ad991
7 changed files with 133 additions and 49 deletions

View File

@@ -5,9 +5,18 @@ import (
"log"
"strings"
_ "github.com/mattn/go-sqlite3"
"github.com/mattn/go-sqlite3"
"github.com/nkanaev/yarr/src/content/htmlutil"
)
func init() {
sql.Register("sqlite3_yarr", &sqlite3.SQLiteDriver{
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
return conn.RegisterFunc("strip_html", htmlutil.ExtractText, true)
},
})
}
type Storage struct {
db *sql.DB
}
@@ -28,7 +37,7 @@ func New(path string) (*Storage, error) {
path = path + "?" + params
}
db, err := sql.Open("sqlite3", path)
db, err := sql.Open("sqlite3_yarr", path)
if err != nil {
return nil, err
}