"build:hugo:prod": "hugo",
"build:hugo:watch": "hugo serve -DF",
"build:search": "./search/webidx.pl public ./static/search.db",
+ "build:search:compress": "brotli -fZk ./static/search.db && gzip -fk9 ./static/search.db",
"build": "npm-run-all --sequential build:css:prod build:hugo:prod build:search",
"serve": "npm-run-all build:hugo:watch",
"dev": "npm-run-all --parallel build:hugo:watch build:css:watch",
"deploy:server": "rsync -avx --delete --exclude '.git/' --exclude 'node_modules/' --exclude 'search/data/' ./ bs-site:/var/www/bookstackapp.com/",
- "deploy": "npm-run-all --sequential build:css:prod build:hugo:prod build:search deploy:server",
+ "deploy": "npm-run-all --sequential build:css:prod build:hugo:prod build:search build:search:compress deploy:server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Dan Brown",
npm run build:search
```
-Note: you may need to install some dependencies to run the script see the `search/webidx.pl` for more information.
+**Note:** you may need to install some dependencies to run the script see the `search/webidx.pl` for more information.
-The above command will build the sqlite index database to `static/search.db`, intended to be deployed to production. In production use, this should be served with compression active to significantly reduce transfer size.
+The above command will build the sqlite index database to `static/search.db`, intended to be deployed to production. There is also a `npm run build:search:compress` command to compress the database file using brotli and gzip (requires both to be installed). In production use, these compressed files should be deployed then served from their compressed state where possible. Here's relevant config for nginx:
+
+```nginx
+location ~* \.(db)$ {
+ brotli_static on;
+ gzip_static on;
+}
+```
Much of the search UI handling logic can be found in our `themes/bookstack/static/js/scripts.js` file.
\ No newline at end of file