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

Algolia search does not find code in code blocks? #3172

Closed
slorber opened this issue Jul 30, 2020 · 11 comments
Closed

Algolia search does not find code in code blocks? #3172

slorber opened this issue Jul 30, 2020 · 11 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@slorber
Copy link
Collaborator

slorber commented Jul 30, 2020

🐛 Bug Report

Search for beforeDefaultRemarkPlugins

This term exist here in a code block: https://v2.docusaurus.io/docs/using-plugins/#docusaurusplugin-content-blog

@slorber slorber 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 and removed status: needs triage This issue has not been triaged by maintainers labels Jul 30, 2020
@slorber
Copy link
Collaborator Author

slorber commented Jul 30, 2020

@francoischalifour any idea?

@anshulrgoyal
Copy link
Contributor

the code block is not scrapped by default

@anshulrgoyal
Copy link
Contributor

u need to add it scrap config

@s-pace
Copy link

s-pace commented Jul 31, 2020

👋 @slorber and @anshulrgoyal,

I am part of the DocSearch team.

Usually we do not recommend indexing code samples. These samples are often very similar and duplicated along your documentation such as examples. It introduces noise to the user experience. Displaying matching code would require to enlarge the snippeting to give the context of the matching token.
There is also room for improvement in the way we handle special characters such as dot and dash that can’t be interpreted as separators yet. This is an improvement that we’re investigating on.

@anshulrgoyal
Copy link
Contributor

Hi @s-pace,
I am trying to build an offline search feature for docusaurus. Here is the PR #3153 and https://deploy-preview-3153--docusaurus-2.netlify.app are deployed link. It would be great if u can give some feedback.

@slorber
Copy link
Collaborator Author

slorber commented Jul 31, 2020

Hi @s-pace

Wonder if you have an idea to index correctly API items that are only found in code-block? Do we rather document everything outside of code blocks too?

@s-pace
Copy link

s-pace commented Jul 31, 2020

I would definitely recommend to document all API items outside of code-block. It enables a better UX to redirect end users with scrolling to the exact matching item. It also helps to give the context of the matching item when the search query is matching the description of the API item. Last but not least, the relevancy would be better since matching a lvl3 / <h3/> element has a stronger impact on the ranking formula.

@slorber
Copy link
Collaborator Author

slorber commented Aug 3, 2020

Thanks

Closing this, but we'll need to document better some attributes that are only found in code blocks

@s-pace
Copy link

s-pace commented Aug 4, 2020

👋 @slorber
Just a follow up that thanks to algolia/docsearch-configs@cfc5738 we are now indexing CLI options such as --skip-build
image

@slorber
Copy link
Collaborator Author

slorber commented Aug 5, 2020

thanks

wonder what you can do for the original usecase I had ^^ (beforeDefaultRemarkPlugins)

@s-pace
Copy link

s-pace commented Aug 6, 2020

👋 @slorber

beforeDefaultRemarkPlugins is too much present within the page. Elements matching [class^='codeBlockContent_'] selector are too similar and it degrades the search experience. Last but not least, we recommend that selectors match small piece of text to enhance the relevancy. These code blocks are too long.

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
Projects
None yet
Development

No branches or pull requests

3 participants