Highlight with unexpected results

Author: doppelrittbergerCreated Sep 9, 2025Updated Sep 11, 2025

Hey

I use your cool library for fulltext search and tried using the highlight feature. Seems working mostly fine but I found some examples which I cannot explain.

I created a test here: flexsearch.html

If you run this you will see it searches for start of german word "urlaub" (vacation) and the first highlight is perfect: Be<b class='xyz'>urlau</b>bung. The second highlight instead appears to be wrong: auf-<b class='xyz'>beurl</b>aubung

I would expect the second highlight like this: auf-be<b class='xyz'>urlau</b>bung

Is there any chance you could give me a hint about what I'm doing wrong?

Thanks in advance