Add Pagefind incremental indexing#2890
Open
MoshiMoshiMochi wants to merge 9 commits intoMarkBind:masterfrom
Open
Add Pagefind incremental indexing#2890MoshiMoshiMochi wants to merge 9 commits intoMarkBind:masterfrom
MoshiMoshiMochi wants to merge 9 commits intoMarkBind:masterfrom
Conversation
It takes in an array of pages that needs to be updated. Filters if the page is need searchable, then add a new HTML file to update the in-memory index. Finally, we retrieve all the in-memory indexes, wipe the old files and write newly updated files to disk.
add & change handlers use updatePagefindIndex as there is only a need to either add/update 1 file in-memory. However, as there is no way of to remove just 1 specific index file from in-memory indexes, remove handler will use indexSiteWithPagefind, meaning that it will reindex the entire site. There might be a better solution out there. But since removing already calls rebuildSourceFiles which takes significantly longer that it takes to reindex the site. I don't think its a big deal.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2890 +/- ##
==========================================
+ Coverage 71.35% 71.75% +0.39%
==========================================
Files 133 133
Lines 7229 7285 +56
Branches 1611 1720 +109
==========================================
+ Hits 5158 5227 +69
+ Misses 2065 2052 -13
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
14 tasks
Now serving one page will directly call updatePagefindIndex with the respective page to build instead of calling indexSiteWithPagefind which will attempt to index all other pages too, even if they DNE. Still need to update test cases... arghhhhhhh lol
Removed warning about how pagefind only works on full site build as that is no longer the case after these changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
Overview of changes:
closes #2873
Implemented incremental Pagefind search index
Anything you'd like to highlight/discuss:
The incremental Pagefind search index works in the following manner.
For deleting I couldn't find a way to remove just 1 specific index file from in-memory indexes. Hence, I decided that the remove handler will use
indexSiteWithPagefind, meaning that it will reindex the entire site. There might be a better solution out there. But since removing already callsrebuildSourceFileswhich takes significantly longer than it takes to reindex the site, I don't think its a big deal. But hey just something to note if possible to improve ig.Technically this some what tackles #2882 but it does so indirectly as we no longer call
indexSiteWithPagefindwhen serving one-page, instead we callupdatePagefindIndexwhich incrementally indexes pages.Testing instructions:
Full build:
markbind serve -dOne-Page:
markbind serve -oProposed commit message: (wrap lines at 72 characters)
Add Pagefind incremental indexing
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):