Now, when I started correcting the search function, I also expanded the class Search in file Serch.php in core CMSimple with sorted results list.

Sorted result list has the following order:
1 exact match
2 All keywords are found on the page
3 only some keywords are found on the page

And finally, if search has only one result, the extended version redirects to the actual page with keywords instead of displaying a result page with link to the page. This work fine with javascript highlights as javascript scroll the page to the first hit.

Changes to the core code will of course be overwritten by the next update of CMSimple XH. By that time, I hope that the the bug is corrected and that the development team implements the extension to the search function itself. The development team is of course welcome to use my code.

in your website https://simplesolutions.dk/ the workoraand already seems to be implemented, right?
I tested the search there once, works well, also the direct forwarding to the page, if the search has only one result.

There is one problem. I know normally no one would ever search for a protected space, but I did it with the following result.
1. https://example.com/?search=%C2%A0&function=search
2. the page "Result of your search" is displayed
3. if you now click on a link in the result list, this page will be loaded, but the page freezes, no action possible .
After about 40 seconds a popup appears with the message "Seite reagiert nicht ...".
The popup disappears after a few minutes and a blank white page is displayed.

Now, when I started correcting the search function, I also expanded the class Search in file Serch.php in core CMSimple with sorted results list.

Sorted result list has the following order:
1 exact match
2 All keywords are found on the page
3 only some keywords are found on the page

And finally, if search has only one result, the extended version redirects to the actual page with keywords instead of displaying a result page with link to the page. This work fine with javascript highlights as javascript scroll the page to the first hit.

All in all, I like these improvements. However, according to SemVer patches should contain only backward-compatible bug fixes, but no new features. Since only the currently broken highlighting would qualify as bug, I would suggest to postpone the other improvements to XH 1.8.0.

I'm inclined to suggest to do the insertion of the <span class="xh_find"> with JS instead of PHP for XH 1.7.3. However, it seems we'd only need a small bit of searchhi.js to do this.