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

Lunr search index merging words across newlines #1883

Closed
bmcgough opened this Issue Oct 8, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@bmcgough
Contributor

bmcgough commented Oct 8, 2018

The lunr index in minimal-mistakes is fed using an excerpt from each page in /assets/js/lunr/lunr-store.js. The excerpt is passed through strip_newlines which removes any newlines in the excerpt, but does not replace those newlines with anything, resulting in merged words across newlines (ex: foo\nbar becomes foobar, but should become foo bar).

So our search index has many merged words.

I'm not sure where this should be fixed. One option would be to do something stupid in minimal-mistakes like newline_to_br followed by replace: '<br>', ' ' rather than the strip_newlines, but probably the "right" solution is to modify strip_newlines to replace with spaces, or add an option or new function in Liquid to do that. It looks like Liquid's replace cannot easily to used on newlines directly (which is presumably why the newline specific function exist).

What do you think?

@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Oct 8, 2018

Owner

Probably not going to modify Liquid or introduce a new function there that would make its way to Jekyll anytime soon 😉

But I think your proposal is probably the best option give what's available to us. Care to submit a pull request removing strip_newlines and using carefully constructed replaces to get around the merged words?

Owner

mmistakes commented Oct 8, 2018

Probably not going to modify Liquid or introduce a new function there that would make its way to Jekyll anytime soon 😉

But I think your proposal is probably the best option give what's available to us. Care to submit a pull request removing strip_newlines and using carefully constructed replaces to get around the merged words?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment