-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Algolia search does not pass query string correctly and returns no results #9532
Comments
Most likely Docusaurus sends the right query, but your index is not configured correctly according to our recommendations. For our queries to work, the index must contain the query fields we query on, notably the "docusaurus_tag" field. Please delete your index and recrawl your site with the recommended crawler configuration that we link to in our documentation. If it still does not work then we can re-open but we'll need you to provide your crawler config and screenshots of your Algolia index UI. You can also reach out to the DocSearch support team through email or on their Discord. |
Thanks for the info. I was able to get it working by creating a new crawler, re-indexing the site, and setting contextualSearch to False. |
Setting it to false might work but might also "hide" the problem. This setting disable the filtering on |
I duplicated the crawler in the docusaurus documentation and made the small changes for my site:
I re-indexed the site with this crawler and I can see that it is indexed on the However, I still see no results in my search when I turn contextualSearch off. What does my index need to look like to work correctly? |
Per your comment here: |
This reverts commit f3872a4.
Contextual search should rather be on, not off I don't know all the algolia docsearch details to be able to troubleshoot this on your site but you can reach out to their support if needed. Cc @shortcuts |
Had similar problem. Looks like I passed this quest, will add instruction which helped me to get non-empty results with Algolia search widget:
After that in my case queries finally started to return results. |
This is what fixed it for me: I changed this code:
to:
Then I deleted the index and re-indexed. |
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:
See also: #10007 (comment) |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I'm using the built-in Algolia search features of docusaurus in preset-classic. I know that my site is indexed and that my API key works because I can do a simple search from a curl request and get results. For example, this command searches for the keyword "contract" and returns many results from docs.tezos.com:
When I open my site at docs.tezos.com and do a search for the same word, I get no results. In the Algolia dashboard, I see many results with an empty "query" field in the request, so that's probably why the searches return no results.
![Screenshot 2023-11-10 at 1 19 16 PM](https://private-user-images.githubusercontent.com/6494785/282148283-3cb5ce68-2618-41ec-90e6-69ff17e0f9ea.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NDY1MTIsIm5iZiI6MTcxODc0NjIxMiwicGF0aCI6Ii82NDk0Nzg1LzI4MjE0ODI4My0zY2I1Y2U2OC0yNjE4LTQxZWMtOTBlNi02OWZmMTdlMGY5ZWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MThUMjEzMDEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Yjg4MzgxNWE0MjIyMmM2NTUxYzVmYjRkNWM1ZDU5MTU1ZGQ4OTc0MWNlOTJlNWNjOTMxMDFkOTg3YThjNjgxNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.IUfoVRoSKprU_O2TYAESXbNJJrTH8VkKEnqdYzv4HHc)
When I open the console and grab the URL of one of the search requests to Algolia, its form data looks like this:
I can copy this network request as a curl command from the console, run it in my terminal, and confirm that it gets no results.
Based on Algolia's API documentation for this API endpoint, the form data should look like this:
If I replace the data in the network request with this JSON, the curl command returns results.
So it appears to me that docusaurus or the algolia search component (@docsearch/react) is sending a malformed query to algolia, causing it to return no results.
Reproducible demo
https://github.com/trilitech/tezos-developer-docs
Steps to reproduce
nbHits
field is 0 and the hits array is empty.--data-raw
with this line:nbHits
field say 356.Expected behavior
Get search results
Actual behavior
No search results
Your environment
Self-service
The text was updated successfully, but these errors were encountered: