Hey guys, I've been checking out Pagefind and it works pretty great! I integrated it with my tiny website and it works pretty much flawlessly. The installation was super easy and the UI is slick, fast and lightweight. Lots of fun.
I went ahead and did some testing with a bigger site. I grabbed the largest static website that came to mind, which is the entirety of the Unity manual. It's actually an excellent comparison case because the docs (both the online and offline version) also use client-side search (that needs to grab an enormous ~10MB index).
The bundle is generated very quickly given how many pages there are to index.
$ C:\src\UnityDocumentation\node_modules\.bin\pagefind --source en
Running Pagefind v0.6.1
Running from: "C:\\src\\UnityDocumentation"
Source: "en"
Bundle Directory: "_pagefind"
Walking source directory...
Building search indexes...
Did not find a data-pagefind-body element on the site.
↳ Indexing all <body> elements on the site.
Indexed 29977 pages
Indexed 99142 words
Indexed 0 filters
Created 225 index chunks
Finished in 41.730 seconds
Done in 42.01s.
I deployed a Pagefind version of the docs search here on GitHub Pages and played around with it a little. The amount of data that PageFind needs to transfer is much smaller, so the core concept definitely works great. However, there's a couple of common cases where the search engine freezes up quite heavily.
For example, here's a Firefox profile of a search for the letter "a". The search engine seems to freeze up for a couple of seconds (on a pretty fast desktop machine). Obviously, a lot of search queries will start with that, so it's a bit of an issue. Other degenerate queries include an
, t
the
, c
, t
, time
, etc - anything that's short enough that it will generate lots of hits. (Again, none of this impacts me currently at all, but it could impact someone eventually...)
Same thing if the user types a special character like space, dot or comma - the engine seems to generate tens of thousands of hits for that. I don't think it's very useful that a query like this generates any hits at all, although maybe this is more of a pagefind-ui issue, not sure.
Finally, I wanted to link the index back to the original documentation website at docs.unity3d.com. Sadly, I was unable to set this up. As I understand, this could be eventually solved by #17, although that seems like a solution to a much bigger problem than mine - If I understand correctly, all I really needed is being able to separate the bundlePath
from the URL appended to the hit result link. This could probably be achieved by modifying pagefind-ui, but it would be nice to have a built-in way to handle this.
Take a look at the test page if you want to play with it: https://apkd.github.io/pagefind-benchmark
Thanks!