Skip to content

Lunr search index merging words across newlines #1883

Closed
@bmcgough

Description

@bmcgough

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions