Skip to content
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

The result of the search can not be displayed correctly on the full search page and get an error, but it can be displayed correctly in the dialog view #9200

Closed
6 of 7 tasks
urfreespace opened this issue Aug 4, 2023 · 11 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests)

Comments

@urfreespace
Copy link

urfreespace commented Aug 4, 2023

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

website: https://pulsar.apache.org/
error search display demo: https://pulsar.apache.org/search/?q=k8s

The result of the search can not be displayed correctly on the full search page and get an error, but it can be displayed correctly in the dialog view

Error detail:

Uncaught (in promise) Error: Uncaught, unspecified "error" event. ([object Object])
    at t.emit (1a4e3797.9530b31a.js:2:775)
    at d._dispatchAlgoliaError (1a4e3797.9530b31a.js:2:41011)
t.emit @ 1a4e3797.9530b31a.js:2
d._dispatchAlgoliaError @ 1a4e3797.9530b31a.js:2
Promise.catch (async)
d._search @ 1a4e3797.9530b31a.js:2
d.search @ 1a4e3797.9530b31a.js:2
(anonymous) @ 1a4e3797.9530b31a.js:2
(anonymous) @ main.9587d1e9.js:2
(anonymous) @ 1a4e3797.9530b31a.js:2
setTimeout (async)
(anonymous) @ 1a4e3797.9530b31a.js:2
zc @ main.9587d1e9.js:2
t.unstable_runWithPriority @ main.9587d1e9.js:2
Va @ main.9587d1e9.js:2
Ic @ main.9587d1e9.js:2
(anonymous) @ main.9587d1e9.js:2
D @ main.9587d1e9.js:2
y.port1.onmessage @ main.9587d1e9.js:2
image

Reproducible demo

https://github.com/apache/pulsar-site

Steps to reproduce

  1. git clone git@github.com:apache/pulsar-site.git
  2. yarn install
  3. npm start
  4. Go to http://localhost:3000/ and open Developer Tools
  5. Click search input on the top navigation
  6. Input any keyword, for example:k8s
  7. scroll to the bottom of the search result list, click See all 10 results
  8. See error

Live reproduction:
http://localhost:3000/search/?q=k8s

search

Expected behavior

The result of the search can be displayed correctly on the full search page

Actual behavior

website: https://pulsar.apache.org/
error search display demo: https://pulsar.apache.org/search/?q=k8s

The result of the search can not be displayed correctly on the full search page and get an error, but it can be displayed correctly in the dialog view

Error detail:

Uncaught (in promise) Error: Uncaught, unspecified "error" event. ([object Object])
    at t.emit (1a4e3797.9530b31a.js:2:775)
    at d._dispatchAlgoliaError (1a4e3797.9530b31a.js:2:41011)
t.emit @ 1a4e3797.9530b31a.js:2
d._dispatchAlgoliaError @ 1a4e3797.9530b31a.js:2
Promise.catch (async)
d._search @ 1a4e3797.9530b31a.js:2
d.search @ 1a4e3797.9530b31a.js:2
(anonymous) @ 1a4e3797.9530b31a.js:2
(anonymous) @ main.9587d1e9.js:2
(anonymous) @ 1a4e3797.9530b31a.js:2
setTimeout (async)
(anonymous) @ 1a4e3797.9530b31a.js:2
zc @ main.9587d1e9.js:2
t.unstable_runWithPriority @ main.9587d1e9.js:2
Va @ main.9587d1e9.js:2
Ic @ main.9587d1e9.js:2
(anonymous) @ main.9587d1e9.js:2
D @ main.9587d1e9.js:2
y.port1.onmessage @ main.9587d1e9.js:2
image

Your environment

  • Public source code: https://github.com/apache/pulsar-site
  • Public site URL: https://pulsar.apache.org/
  • Docusaurus version used: 2.4.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome Version 115.0.5790.170 (Official Build) (arm64) , Node.js v16.17.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 13.4.1

Self-service

  • I'd be willing to fix this bug myself.
@urfreespace urfreespace added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 4, 2023
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Aug 4, 2023
@slorber
Copy link
Collaborator

slorber commented Aug 4, 2023

Our Docusaurus code expects search hits to have a _highlightResult.hierarchy attribute available:

CleanShot 2023-08-04 at 14 32 28@2x

But in your case this attribute seems absent and the response is quite different:

CleanShot 2023-08-04 at 14 32 55@2x


I'm going to close because IMHO it's very likely not a bug, but an algolia crawler configuration problem that does not match our official recommendations.

You are free to use a different configuration if you want, but we can't provide support for that.


@shortcuts can probably confirm, but most likely your site doesn't have the appropriate Algolia config that we recommend in our docs:

Notably: attributesToHighlight: ['hierarchy', 'content'],

Please double-check your entire setup and reindex your site.

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@slorber slorber added the closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests) label Aug 4, 2023
@shortcuts
Copy link
Contributor

Hey, yes I'd suggest the same way to solve it, this is most likely a misconfiguration of the Crawler. Considering you have all other properties, updating the index settings should be enough

@urfreespace
Copy link
Author

I checked our crawler configuration, seems it's right, pls see the below image, and I reindex the full index, but the problem is still happen @slorber @shortcuts

image

@shortcuts
Copy link
Contributor

hey @urfreespace, those index settings are called initialIndexSettings because they are only applied when the index does not yet exist (a bit tricky to see, I agree)

to prevent having to do this manually, you can delete the index and then restart the crawl

@urfreespace
Copy link
Author

urfreespace commented Aug 7, 2023

working fine now, big thanks @shortcuts @slorber

@shortcuts
Copy link
Contributor

enjoy!

@slorber
Copy link
Collaborator

slorber commented Aug 9, 2023

hey @urfreespace, those index settings are called initialIndexSettings because they are only applied when the index does not yet exist (a bit tricky to see, I agree)

Ah yes, this is easy to miss 😅 It's not the first time someone reports updating the config and getting no improvements. Now I understand and will be able to guide our users better. I guess it could be worth it to write a troubleshooting section in ours docs?

Can the index be updated manually instead of delete/recreate? I guess some will not like this idea and would prefer an incremental index upgrade?

@shortcuts
Copy link
Contributor

Can the index be updated manually instead of delete/recreate? I guess some will not like this idea and would prefer an incremental index upgrade?

Sure, you have access to a configuration tab in the dashboard: https://dashboard.algolia.com/apps/$APP_ID/explorer/configuration/$INDEX_NAME/searchable-attributes and https://dashboard.algolia.com/apps/$APP_ID/explorer/configuration/$INDEX_NAME/facets, are the two links the user would edit settings

@Bibazavr
Copy link

Bibazavr commented Jan 9, 2024

hey @urfreespace, those index settings are called initialIndexSettings because they are only applied when the index does not yet exist (a bit tricky to see, I agree)

I guess, that need add into docs somewhere

@shortcuts
Copy link
Contributor

shortcuts commented Jan 9, 2024

is it documented in the Crawler documentation https://www.algolia.com/doc/tools/crawler/apis/configuration/initial-index-settings/ but indeed we should reference it in the DocSearch documentation

@slorber
Copy link
Collaborator

slorber commented Apr 5, 2024

EDIT: see Troubleshooting section added to our docs here:

https://docusaurus.io/docs/search#algolia-troubleshooting

No search result?

For anyone passing by, if you don't get any Algolia search results:

  • make sure that your Algolia index has the fields in the screenshot below
  • If you don't see these fields, then you have an index config problem
  • You should check your crawler config, make sure it matches the recommended one, and then delete/recreate your index based on the newly updated/fixed crawler config (Algolia team recommendation)

image

See also: #10007 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests)
Projects
None yet
Development

No branches or pull requests

4 participants