OK I was able to prove to myself that I can write a https://dropserver.org app that returns the results of a search query for a static website in under 50 lines of code (actual "search" done by lunr.js module).
To really demo this I'll create a search backend for my personal site and maybe for dropserver.org as well.
But for that I need to build out a couple features in the Dropserver platform:
- permissions to allow outbound network requests
- auth via JWS or token
Here's how a Dropserver app for searching a static site could work:
- a route behind token auth that Netlify (or whatever builds your site) calls after a new version of site is deployed
- after that route is called, app fetches the content json and generates an index, which gets stored in appspace data dir.
- a public search endpoint that leverages the index to return search results
- private route(s) for the appspace owner where get/set the url of the content json, and last fetch date
Some notes on search libraries for dropserver after spending a few minutes looking into it:
- lunr.js was the old go-to but seems no longer supported. Was awkward to use in Deno especially in TS file.
- Stork looks intriguing: https://stork-search.net/ but have not tried. WASM indicates should run fine. Currently being worked on.
- I'd also try loading the content into a sqlite DB and use the FTS5 module. Big advantage is not needing to load entire index in memory to search (I think?)
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!