Hacker News new | past | comments | ask | show | jobs | submit login
Pagefind: Static Low-Bandwidth Search at Scale (cloudcannon.com)
76 points by chmaynard on Aug 1, 2022 | hide | past | favorite | 10 comments



I recently deployed pagefind on my web site and it was pleasingly easy, and the result is reasonably nippy https://dotat.at/search.html


Nice, thanks! A while ago I was looking for a a search lib precisely like this for my blog. I really like the idea of a client-side search - it feels extremely responsive to use compared to server side. The bandwidth-saving chunking tech is a nice bonus that I didn't expect - the websites I've used seem to naively load the entire index.


So.... A complete index of my site is too large...

So I could chunk the index up... For example, one index for words beginning with each letter of the alphabet. I could host the index for words beginning with 'a' at mysite.com/search/a

But I could do yet smaller indexes! I could make one index for each word. Ie. use the URL mysite.com/search/abacus

We could call these mini-indexes search result pages...


That is, in essence, what Pagefind is doing under the hood — but Pagefind also addresses the other reply in that it can combine these results when you search multiple words (among many other search benefits)


It's not quite that simple because the user can search for more than one word. Generating all searches for one or two words is probably feasible but not much more than that. After that you probably do want to just generate one index per word and merge them together at search time to dynamically generate the search result page.


This looks fantastic! I've used Lunr [0] (a client-side search engine), but as noted in the article, the index is huge and search is quite slow for a site with a lot of content. Splitting the index up is a great idea. Thank you!

[0]: https://lunrjs.com/


Five years ago when I switched from WO to Hugo I wrote my own solution based on SQLite’s fts5 full-text search and using Hugo itself so the results match the theme of your site:

https://github.com/fazalmajid/fts5index


I wonder how this compares to algolia? I recently added that to an open source project I released recently and the search results aren’t just not relevant they aren’t even close to correct. It works by first indexing your site by scraping it.

Not sure why everyone seems to use it.


I wrote out an explainer recently on HN answering exactly that: https://news.ycombinator.com/item?id=32172290


Im working on a Hugo website, and it already includes a search engine. Does Hugo include a search index ? And If so, is PageFind that much better?

The theme I'm trying hugo-theme-stack.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: