olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.94k stars 548 forks source link

Demo is not working #467

Closed trusktr closed 4 years ago

trusktr commented 4 years ago

reproduce:

And similar with other searches.

Screenshot:

lunr-not-working

niknbr commented 4 years ago

I suppose since it is a matching terms, and there is not word shep on the page, it would not show any results.

Instead we can use wildcard matching shep*, in which case it matches Shepard. ref

trusktr commented 4 years ago

Ah, I see! Most website searches that I know of work more like a fuzzy finder, which I believe many people expect.

A few examples:

Is there an option to enable fuzzy search?

niknbr commented 4 years ago

Yes it supports fuzzy search like this shep~1 where 1 is the edit distance. More details here

olivernn commented 4 years ago

The demo site is intended only to be able to demo the features of Lunr. The input entered in the search box is passed straight to lunr.Index#search. This doesn’t add any implicit wildcards or any other modifiers as already mentioned.

You’re right that in many cases wildcard or fuzzy searching would be a user’s expectation. Using lunr.Index#query it is possible to have that level of control on how a query is interpreted.