Skip to content

feat: add Algolia DocSearch configuration#1380

Open
Abhash-Chakraborty wants to merge 4 commits intorecodehive:mainfrom
Abhash-Chakraborty:Abhash/Algolia-1
Open

feat: add Algolia DocSearch configuration#1380
Abhash-Chakraborty wants to merge 4 commits intorecodehive:mainfrom
Abhash-Chakraborty:Abhash/Algolia-1

Conversation

@Abhash-Chakraborty
Copy link
Copy Markdown
Member

@Abhash-Chakraborty Abhash-Chakraborty commented May 2, 2026

Summary

  • add conditional Algolia DocSearch wiring in Docusaurus using ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, and ALGOLIA_INDEX_NAME
  • enable the navbar search item only when the full Algolia config is present
  • document that ALGOLIA_INDEX_NAME must be the real Algolia index name created by the crawler
  • merge the latest upstream/main into this branch

Verification

  • npm run build
  • npm run lint ✅ (warnings only)
  • npm run typecheck ❌ existing repository-wide TypeScript errors unrelated to this branch

Notes

  • The current runtime Index ... does not exist error should clear once DocSearch indexing is completed and ALGOLIA_INDEX_NAME points to the actual Algolia index name rather than a crawler/config id.

Closes: #44

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2026

@Abhash-Chakraborty is attempting to deploy a commit to the recode Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@github-actions github-actions Bot added the recode this is label for leaderboard label May 2, 2026
@Abhash-Chakraborty Abhash-Chakraborty marked this pull request as ready for review May 2, 2026 03:49
Copilot AI review requested due to automatic review settings May 2, 2026 03:49
@Abhash-Chakraborty Abhash-Chakraborty marked this pull request as draft May 2, 2026 03:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional Algolia DocSearch support to the Docusaurus site so search can be enabled cleanly once the required Algolia credentials are available, without breaking builds or showing a nonfunctional navbar search entry.

Changes:

  • Read Algolia DocSearch environment variables in docusaurus.config.ts and enable search only when the full config is present.
  • Conditionally add the navbar search item and Algolia theme configuration to avoid partial/misconfigured setup at runtime.
  • Document the required Algolia environment variables in .env.example, including the need to use the real crawler-created index name.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
package-lock.json Lockfile metadata churn from dependency resolution / merge updates.
docusaurus.config.ts Adds conditional Algolia env parsing, warning behavior for partial config, navbar search item wiring, and theme-level Algolia config.
.env.example Documents the new optional Algolia DocSearch environment variables and index-name guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recode-website Ready Ready Preview, Comment May 4, 2026 1:03pm

@Adez017 Adez017 added kind:feature Feature Requests priority:high High priority bug that should be patched quickly but does not require immediate new release level 2 30 points in-review The current changes are in review and would need approval and testing before merging labels May 2, 2026
@Adez017
Copy link
Copy Markdown
Member

Adez017 commented May 4, 2026

@sanjay-kv any updates on this one ?

@sanjay-kv
Copy link
Copy Markdown
Member

image in process

@sanjay-kv sanjay-kv marked this pull request as ready for review May 4, 2026 10:26
@Adez017
Copy link
Copy Markdown
Member

Adez017 commented May 4, 2026

@sanjay-kv , can you attach the code given in the agolia documentation for implementation

@sanjay-kv
Copy link
Copy Markdown
Member

<div id="search"></div>
<script>
  SiteSearch.init({
    container: "#search",
    applicationId: "",
    apiKey: "",
    indexName: "",
    attributes: {
      primaryText: "title", // the attribute to display in the hits list
      secondaryText: "description", // the secondary attribute to display in the hits list
      tertiaryText: "headers", // the tertiary attribute to display in the hits list
      url: "", // the URL of the hit
      image: "image" // the image URL of the hit
    },
    darkMode: false,
  });
</script> 

@Adez017 app id has to replace with env variables, i have changed it in the vercel env files

Comment thread docusaurus.config.ts Outdated
Comment on lines +275 to +276
apiKey: algoliaSearchApiKey!,
indexName: algoliaIndexName!,
contextualSearch: true,
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Abhash-Chakraborty can you clarify about this :: the agolia haven't been configured correctly

@Adez017
Copy link
Copy Markdown
Member

Adez017 commented May 4, 2026

@sanjay-kv i dont think the script has been configured correctly in the PR , if the changes are already been there @Abhash-Chakraborty can help with any updates on this .

@github-actions github-actions Bot added area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code enhancement New feature or request roadmap The issues /PR that are big changes on the roadmap labels May 4, 2026
@github-actions github-actions Bot added this to the recode:launch 3.0 milestone May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

✅ Synchronized metadata from Issue #44:

  • Labels: enhancement, kind:feature, area:dev-env, roadmap, level 2, recode
  • Milestone: recode:launch 3.0

@Abhash-Chakraborty
Copy link
Copy Markdown
Member Author

Abhash-Chakraborty commented May 4, 2026

I checked the Algolia app directly. The value previously used for ALGOLIA_INDEX_NAME (34b4748a2aa439e43189350c2e1b0a6d) is not an existing index, which is why the preview threw Index ... does not exist. The crawler has created these indexes instead: www_recodehive_com_8oew5oqz0y_pages, www_recodehive_com_8oew5oqz0y_articles, and www_recodehive_com_8oew5oqz0y_products.

I also updated the implementation to match the Algolia SiteSearch snippet shared above instead of Docusaurus DocSearch. The navbar now mounts SiteSearch.init from Algolia SiteSearch and maps the crawler fields: title, description, headers, url, and image.

For Vercel, please set ALGOLIA_INDEX_NAME=www_recodehive_com_8oew5oqz0y_pages for this PR preview. I verified npm run build passes and npm run lint passes with existing warnings only.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code enhancement New feature or request in-review The current changes are in review and would need approval and testing before merging kind:feature Feature Requests level 2 30 points priority:high High priority bug that should be patched quickly but does not require immediate new release recode this is label for leaderboard roadmap The issues /PR that are big changes on the roadmap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agolia implementation.

4 participants