From 59018336e7923353ade0552f20c09585c1d63df5 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 14 Dec 2023 16:55:50 +0100 Subject: tested absurd-sql, couldnt make that one work --- search/fts5/README | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/search/fts5/README b/search/fts5/README index f1c5006..681b425 100644 --- a/search/fts5/README +++ b/search/fts5/README @@ -15,7 +15,7 @@ cat < posts.sql sqlite3 posts.db < posts.sql @@ -24,8 +24,9 @@ cp posts.db ../../static/index/. # some test queries # https://www.legendu.net/misc/blog/hands-on-full-text-search-in-sqlite3/ # https://sqlite.org/fts5.html -select uri from posts where posts MATCH 'OpenBSD' ORDER BY bm25(posts); -select uri,highlight(posts, 1, '', ''),snippet(posts, 2, '', '', '...', 50) from posts where posts MATCH 'OpenBSD' ORDER BY bm25(posts) limit 5 offset 0; +sqlite3 posts.db +sqlite> select uri from posts where posts MATCH 'OpenBSD' ORDER BY bm25(posts); +sqlite> select uri,highlight(posts, 1, '', ''),snippet(posts, 2, '', '', '...', 50) from posts where posts MATCH 'OpenBSD' ORDER BY bm25(posts) limit 5 offset 0; # TODO: make a server-side search (search window and result page) # this would mean we have to render the hugo and the ranklist part on the server? @@ -59,20 +60,26 @@ In file included from /data/INSTALL/emscripten2/src/llvm-project/llvm/lib/Suppor # hairy to build # let's try a precompiled one # https://verdicts.listen.dev/npm/sql.js-fts5 +# https://www.skypack.dev/view/sql.js-fts5 npm install sql.js-fts5 cp node_modules/sql.js-fts5/dist/sql-wasm.js ../../themes/new_theme/static/js/. cp node_modules/sql.js-fts5/dist/sql-wasm.wasm ../../themes/new_theme/static/js/. -# WASM is not read because of a charset-utf-8 added to application/wasm: https://github.com/gohugoio/hugo/issues/10734 -# hugo-0.120.1-charset.patch + +# WASM is not read with self-hosted hugo server because of a charset-utf-8 added +# to application/wasm: https://github.com/gohugoio/hugo/issues/10734 +# => rebuild Hugo with hugo-0.120.1-charset.patch + +# https://jlongster.com/future-sql-web +# https://github.com/jlongster/absurd-sql +npm install absurd-sql +cp node_modules/absurd-sql/src/sqlite-fs.js ../../themes/new_theme/static/js/. +cp node_modules/absurd-sql/dist/indexeddb-backend.js ../../themes/new_theme/static/js/. # TODO: add as sqlite.js to page with data (local sqlite fts search) # https://blog.ouseful.info/2022/04/06/compiling-full-text-search-fts5-into-sqlite-wasm-build/ -# https://jlongster.com/future-sql-web -# https://www.skypack.dev/view/sql.js-fts5 # https://github.com/phiresky/sql.js-httpvfs # https://github.com/psanford/sqlite3vfshttp # https://phiresky.github.io/blog/2021/hosting-sqlite-databases-on-github-pages/ -# https://github.com/jlongster/absurd-sql # https://github.com/kbumsik/sqlite-wasm sudo pacman -S typescript -- cgit v1.2.3-54-g00ecf