leo-buneev / vuepress-plugin-fulltext-search

Adds full-text search capabilities to your vuepress site with a help of flexsearch library.
MIT License
93 stars 23 forks source link

Not showing all possible matches #64

Open gabysantosw opened 1 year ago

gabysantosw commented 1 year ago

When we have words within the content (specially if they are the first word of a paragraphs), we might not get a match. The reason seems to be parsing of \n, a fix that helped was doing this:

index.add(
      pages.map((p) => ({
        ...p,
        content: p.content.replaceAll(/\n{2,}\s*/g, "\n "),
      }))
    );

within the flexsearch service

nbaud commented 7 months ago

We are having the exact same issue, we will try to implement this fix, thanx :)