CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.22k stars 97 forks source link

search results are returned when they shouldn't be, with non matching terms highlighted #599

Open louismorgan-linaro opened 2 months ago

louismorgan-linaro commented 2 months ago

If you go to the demo here https://mdn.pagefind.app/ and type in sdafadsfasdf (for example), 23 results are returned all seeming to match the sd part of the query.

I have seen in my own website that I'm developing even weirder behaviour where something like the word intermediate will be matched along with things like sd.

I can only assume this is a bug to do with stemming/backtracking etc. ?

bglw commented 2 months ago

Currently not a bug per-se, but just the effect of Pagefind's backtracking not having a cap, so it'll backtrack your query until it finds something.

Some sane limit should be put on this, but in the absence of picking some arbitrary sane limit I have left it with no limit 😅

Open to suggestions!

louismorgan-linaro commented 2 months ago

Any possibility to have it configurable with pagefind.options or similar?

I can see that in some circumstances this behaviour would be desirable but in other cases not, so letting the user configure it makes the most sense ( and the default can be as is, of course)