-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
switch gitbook search engine to fuse.js #1031
Comments
Yes, we'll replace lunr.js with fuse.js. Thanks for the suggestion! |
I would just like to more enthusiastically upvote this issue 🤣 |
Thank you! :) |
Listing some search improvement :
|
For reference another alternative: https://stork-search.net/ We need to evaluate with other projects as it could be a better candidate. |
Stork Search looks fairly heavy. I left a comment about the index size here, but that is already ignoring the sizes of stork.wasm and stork.js, which together add up to about 600KB on their own. It's fast, but I'm not sure it scales until they get the index size under control. Even then I'm leery of the extra 600KB added to the page size. For the sake of comparison, the search engine that SphinxDoc uses doesn't search on every keystroke, just when you hit return. However, it creates an index that is less than 40KB for my book that is 1.1MB. Then when you do a search it loads the data only from the files where the result is found. In other words, the worst case scenario in terms of size is the size of the content being searched, plus the size of the index (tiny) and all the rest of the javascript on the page is 51KB, the majority of that being jquery. I threw the large book that is unusable on bookdown into sphinx-doc for a quick test. You can check it out and see the search working here. |
Note that this post was linked in a previous discussion, and it discusses some of the options and tradeoffs on speed. Here's another comparison of several engines: And here's another showing popularity, if that matters: |
Just sharing this issue #1141 so that we don't forget that search should work in all kind of text, included indent text |
Perhaps I should open another issue, but is it possible to also get Elasticsearch supported by bookdown? Am I right in understanding that it’s already supported in related projects like pkgdown? |
I think pkgdown will use fuse.js too to have a local search. Currently, pkgdown allows to connect an online service provided by Algolia called DocSearch: https://pkgdown.r-lib.org/articles/search.html |
Sorry to distract, then. |
You can use fuse now: https://github.com/rstudio/bookdown/blob/master/NEWS.md#changes-in-bookdown-version-023 remotes::install_github('rstudio/bookdown') |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Two other issues have mentioned the possibility of switching the gitbook theme to use fuse.js. This would solve language problems (Chinese not currently supported in Lunr) and speed problems (long books are unusable without pre-building the search index in Lunr).
Currently bs4_book uses fuse, and I'm interested to hear whether others would like to see the search engine replaced in the gitbook theme, especially from the maintainers.
By filing an issue to this repo, I promise that
xfun::session_info('bookdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/bookdown')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: