-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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 Contextual Search Generates Incorrect FaceFilters #10050
Comments
We can close this ticket. I figured out the issue. I'm not sure if the default Algolia crawler config is what's causing the issue but {
attributesForFaceting: [
"type",
"lang",
"language",
"version",
"type",
"docusaurus_tag",
]
} I hope this saves other some time 😅 |
Yes, you need to make sure your index match our official recommendations, otherwise it's your responsibility to make things work The recommended config contains that "language" facetting field https://docsearch.algolia.com/docs/templates/#docusaurus-v3-template |
If that helps anyone stumbling on this issue, I posted this answer in a few Algolia issues, hope it helps.
|
@slorber would you be open to a PR that adds this tiny bit of information to the https://docusaurus.io/docs/search#contextual-search page? It could be a tiny lil info box and that also links to the issue #6693 Happy to author it. |
@karl-cardenas-coding thanks for your proposal, but it was already on my todo list to add this index troubleshooting section so I just did it (#10056). We get many support requests about this over time so it's important to explain this thing properly so I preferred to do it myself. |
No worries 😊 @slorber and thank you for adding the updates. That's gonna help a lot for future users. |
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
When experimenting with the Algolia Crawler, I noticed that when contextual search is enabled no results are returned. The API requests are successful (status code 200), but no hits are returned.
I stumbled upon this Aloglia support thread trying to understand what might be causing the issue.
Upon closer investigation I noticed how the
facetFilter
parameter generated by Docusarus is incorrect compared to what Algolia expects.The Crawler’s search UI includes the following values in the searchFacets query when I enable some custom facets such as as docusaurus_tag , version, and language.
This returns results as expected.
Now, in Docusarus, when contextual search in enabled, here is what is provided in the API request.
The list value is not generated correctly.
If I re-create the API post request with this vale for the faceFilter, I get the expected results.
Reproducible demo
No response
Steps to reproduce
You can use this codebox URL.
But or spin up a quick Docusarus project and use my Algolia config or the one included in the Algolia issue.
Expected behavior
The expected behavior is to return the expected results using the facefilter Docusarus includes in the post request.
Actual behavior
No results are returned.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: