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

Tweaking fuse.js configuration to improve search results #1319

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Mar 17, 2022

Context: https://community.rstudio.com/t/bookdown-search/131042/12

  • Add ignoreFieldNorm: true to fuse js

@jtbayly
Copy link
Contributor

@jtbayly jtbayly commented May 5, 2022

Hey @cderv ,

I finally got around to testing this in the javascript console. I didn't specifically test this version of the code, since it was easy to just set ignoreFieldNorm: true in the browser.

It solved the problem we were discussing here: https://community.rstudio.com/t/bookdown-search/131042

If you were to make this change, it would mean that shorter fields wouldn't be scored higher than longer fields. Given that...

  1. we are currently not returning all of the exact matches, which seems to me to be a clear failure, meaning this change will cause some search results to be included that are high quality, and
  2. my limited testing doesn't show returning low quality results after this

I think it makes sense to make this change at least in the dev version so it can receive wider testing.

@jtbayly
Copy link
Contributor

@jtbayly jtbayly commented May 5, 2022

I should have mentioned, we'd want to do this in the gitbook version, too, right? I'm not using the bs4_book theme.

@cderv
Copy link
Collaborator Author

@cderv cderv commented May 5, 2022

Thanks !

we'd want to do this in the gitbook version, too, right?

gitbook() is using default configuration for fuse.js. That is to the user to define the config desired in YAML. bs4_book() is more opinionated so hence this change there.

which seems to me to be a clear failure, meaning this change will cause some search results to be included that are high quality,

Can we improve this ?

@cderv cderv force-pushed the bs4_book/tweak-fuse branch from a04fe19 to 759c109 Compare May 5, 2022
@jtbayly
Copy link
Contributor

@jtbayly jtbayly commented May 5, 2022

Sorry that sentence was unclear. What I meant is that in my limited testing I was only able to find it improving things: Exact matches from longer paragraphs were now showing up in search results as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants