slate icon indicating copy to clipboard operation
slate copied to clipboard

Search not working properly

Open LarsFischer97 opened this issue 2 years ago • 2 comments

Bug Description In the slate demo (https://slatedocs.github.io/slate) the search function does not show any chapters unless you write them out completly.

Screenshots grafik grafik

Browser Tested in

  • OS: [Windows & Android]
  • Browser [Chrome, Firefox, Edge]

LarsFischer97 avatar Mar 22 '22 14:03 LarsFischer97

I found the problem.

https://lunrjs.com/guides/searching.html

Just add (+ "*") this in the search function in _search.js

  var results = index.search(searchInput.value + "*").filter(function(r) {
    return r.score > 0.0001;
  });

LarsFischer97 avatar Mar 29 '22 13:03 LarsFischer97

I also added the wildcard before the searchInput.value. Also, I believe part of the blame is in the lunr stemmer so you can remove it if your page is not going to be extremely long.

this.pipeline.remove(lunr.stemmer)

SirBernardPhilip avatar Jul 28 '23 16:07 SirBernardPhilip