Replies: 1 comment 5 replies
|
So far it hasn't been a goal, since a lot of builds happen in clean CI environments anyway. Some large sites can take a while to index, though in my experience Pagefind is still not using the bulk of the total build time compared to the site generation. Firstly, the pattern of the Pagefind index means nearly any change to the input data will invalidate the cache for all index chunks. One of the more common changes is adding a page to a site, and the words in that site are very likely to be distributed over all index chunks, which means they all need to cache bust. So any incremental feature would mainly be built to improve the speed of the CLI indexing a site. In the past I have looked at having Pagefind re-ingest its own index to then incrementally update it, but you don't gain any meaningful performance there since it's parsing about same amount of data. Another approach is to provide Pagefind a list of new files and files that have changed, which could be used to build an extra index patch. The original index would remain untouched, and the small index patch would also be loaded at search time. It adds bandwidth though, and would only work for some number of rebuilds before you need to rebuild the full thing. There are some ideas that fall out of this, like partitioning the index by month/year and only updating parts as needed, but that needs config and documentation. Finally there is the option of having Pagefind write some kind of database somewhere, though I don't love the concept.
All options are predicated on knowing what files have changed since the prior build, which is also difficult to guarantee in CI. System modification dates are often meaningless, and parsing git histories can be fraught. Plus you do pay some speed (and memory) penalty on building/writing/reading/parsing any extra database while indexing the site. My gut feeling, from the couple of times I have looked at the surface of this, is that Pagefind's parsing is generally quite fast and most incremental approaches don't save enough time for the extra code maintenance / complexity to be worth it. |
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to make the index modifiable? Or partially cachable?
I was thinking of possibly using Sqlite or duckdb to maintain a "local" updateable index staging file, which then generates the file output?
All reactions