Skip to content

Update search.mdx#10838

Closed
lizargall wants to merge 1 commit intofacebook:mainfrom
lizargall:patch-1
Closed

Update search.mdx#10838
lizargall wants to merge 1 commit intofacebook:mainfrom
lizargall:patch-1

Conversation

@lizargall
Copy link

Docusaurus is so user friendly that you don't need to be a front end developer to use it. I couldn't figure out for the longest time why I kept getting error codes when I tried to test the search bar!

Pre-flight checklist

  • [ x] I have read the Contributing Guidelines on pull requests.
  • [ N/A] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • [ N/A] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

It might seem obvious to some folks, but I stalled for a few weeks trying to figure out why my search bar wasn't working and it was all down to the difference between yarn start and yarn build.

Test Plan

The .md preview looks solid

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

Docusaurus is so user friendly that you don't need to be a front end developer to use it. I couldn't figure out for the longest time why I kept getting error codes when I tried to test the search bar!
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 13, 2025
@netlify
Copy link

netlify bot commented Jan 13, 2025

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 5c893b2
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6785690ebd85960008c672f0
😎 Deploy Preview https://deploy-preview-10838--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 67 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🟠 51 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 72 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 62 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 46 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 62 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 71 🟢 100 🟢 100 🟠 86 Report

@slorber
Copy link
Collaborator

slorber commented Jan 16, 2025

Search definitively works locally, but it queries a remote Algolia index that needs to be "filled" with content that is usually crawled from your production website. Algolia can't crawl your localhost site (at least not easily, you'd need to install their crawler) so you need to first deploy your site, then ask Algolia to crawl it, then it will work in both productions and locally.

We already have a warning explaining that:

CleanShot 2025-01-16 at 11 30 12

If it didn't work for you locally, then your index was likely empty, which can be seen on the Algolia dashboard.

If your Algolia index has been created, and it only works in production but not locally, then we'd need a reproduction to investigate why.

@slorber slorber closed this Jan 16, 2025
@lizargall
Copy link
Author

Thanks, I think I've figured out my challenge with you get an empty index if you BUILD it locally. If you just RUN it locally you get an error message IF YOU HAVEN'T built the site with the indexer in place.

I was getting this error message when I added the search bar and was trying to run:

×
ERROR
[object Object]
at handleError (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:252:58)
at eval (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:275:7)

Once I built the site once, this issue went away. Run works fine for previewing the site now.

So indeed I did conflate two issues together.

My issue of the search bar not working with run if you've not built it might be a bit of an edge case.

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

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants