-
-
Notifications
You must be signed in to change notification settings - Fork 832
feat(search): upgrade DocSearch to v4 #3346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: e060e93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hello! Thank you for opening your first PR to Starlight! ✨ Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @dylantientcheu!
I’ll take a proper look later, but quick heads up that this PR should only change the English language docs, not the others. Then our translation contributors will PR translations of the updated content. (At least, I’m assuming you’re not fluent in all of these languages 😁)
Should make it easier for you to contribute that way, and easier for us to review too.
|
Thanks @delucis. I just updated the docs files. If you need to test the integration, use this commit changes: https://github.com/withastro/starlight/compare/4da4fcc8be9a9d2ba2a44c760c645018c0834795..3e8a040af25fee712d1a7a4b2564c690c0a63975 I had to remove it to keep the PR lean. |
|
For some reason, I'm unable to make "favoriting" results and "deleting recent searches" function properly. Maybe the event can't propagate properly? I have no apparent error and I'm having a hard time debugging this. @delucis please, let me know if something pops out during your review |
|
Hey @delucis any chance we can get some eyes on this or merge it? There are a few folks waiting for it. Please let us know! |
|
Hi @NatanTechofNY and @dylantientcheu — yes, thanks for your patience! Do you have a rough timeline of when you’re planning for v4 to move out of beta? I’ll obviously go ahead and review, but I guess we’d time a release to align with the stable v4 release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution 🙌
While waiting for a timeline for a stable release, I went through the changes for an early review (mostly code, I did not take a good look at the docs changes yet) and left a few comment/questions I have.
Also linking to https://docsearch.algolia.com/docs/migrating-from-v3#translations as a reminder which should be helpful when drafting the changeset for the changes to make sure we include the updated translation keys.
|
Looking forward 🥇 , @NatanTechofNY ! |
|
@HiDeoo thanks for the thorough review. I just pushed a few changes to resolve these comments. Let me know if it works for you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update 🙌
I left a few final suggestions mostly to clean up some types and to avoid some type-checking issues but this is looking great! From my local testing using the shared playground configuration, I did not run into any issues.
I'll let Chris take a final look as he's the more familiar with the plugin as he built it and he's more familiar with DocSearch specifically than I am.
Congrats on the new major 👏
|
Thanks for the insight i'll work on this. |
|
@HiDeoo we just upgraded to 4.2 which fixes this issue. Important Remember the values in astro.config.mjs L194-199 are purely for demo purposes and should not go into production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 🙌
I think we need a changeset for the @astrojs/starlight-docsearch package. I suggest a minor bump which describes the update to the docsearch package v4 👍
Do you know how to do that?
If not, you should be able to run pnpm changeset and follow the instructions, if unclear, the maintainers can also do that I think 🚀
|
@trueberryless done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome progress 🙌
I left a small comment refining the changeset wording to better fit Astro's changeset guidelines.
Another question: Could you maybe update the PR description to be up-to-date? Eg it currently mentions "beta" updates, but this was in the past, now we are stable 🥳
…to pr/dylantientcheu/3346
Co-authored-by: Felix Schneider <[email protected]>
|
@trueberryless not to hurry you. We have a few starlight users that are closely watching this PR. When they ping us, we can't do much, we'd love to get this merged :) |
|
Good things take time 😅 From my side, I have nothing to add or reject, but please note that I am not a maintainer. Chris and/or HiDeoo will probably take another close look at the changes. I am deliberately not giving any time frame; all contributors and maintainers are doing this voluntarily, so I kindly ask for your understanding! Nonetheless, I am already looking forward to this upgrade myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left two tiny comments that don’t affect usability at all, just branding and I’m not really sure what to classify the other one as.
Co-authored-by: randomguy-2650 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| starlightDocSearch({ | ||
| appId: 'PMZUYBQDAK', | ||
| apiKey: '24b09689d5b4223813d9b8e48563c8f6', | ||
| indexName: '[Demo][Tmp] Astro Starlight', | ||
| askAi: 'askAIDemo' | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume all of this would be removed later, right? Because the Starlight docs use the default search, Pagefind, by default.
This is just to remind you just in case you forget.
| "@astrojs/starlight": "workspace:*", | ||
| "@astrojs/starlight-docsearch": "workspace:*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well. Replace it with the published versions in the future rather than workspace:*.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use workspace here because the package is local. We'll not need it, when we'll remove the top comment


Description
Upgrade DocSearch to v4 in the Astro docs theme.
This bumps the dependency, wires the new API, and optionally exposes Ask AI.
Additional Context & Motivation
10 years of DocSearch – a decade of better docs discovery
5 years since v3 – time for a fresh UI/UX and new features
We 💙 Astro – first-class integration matters
DocSearch v4 ships a redesigned modal, better accessibility, mobile polish, and is still 💯 free.
Ask AI (opt-in) layers conversational Q&A on top of your Algolia index.
What’s in this PR
@algolia/docsearch-astro→ latest stable v4askAiprop inDocSearch.astroPlayground: https://community.algolia.com/docsearch-playground/
Demo video:
Screen.Recording.2025-07-28.at.12.53.00.2.1.mp4
Features
DocSearch v4
• Modernised UI • Faster load • Recent & favourite searches • Dark-mode aware • ARIA-improved
Ask AI (optional)
• Natural-language Q&A • Free • BYOLLM • Pulls context from your Algolia index • Conversation history
Related Docs