That is correct. The middle-of-the-word searching only applies to search queries, it has no effect on highlighting. There’s currently no way to change that; middle-of-the-word highlighting is not available, because with short words, it creates very messy results.
I can throw in a filter hook in the next version so that middle-of-the-word highlights can be enabled that way.
Thanks for confirming the behavior @msaari …
I appreciate ours is an edge use case, but if a filter could be made available to enable this it would be great please. We are using relevanssi on a REST api method to quickly filter lots of text based on very fuzzy matching so middle word highlight would really enhance this. Thank you in advance!
If you want a hotfix, modify /lib/excerpts-highlights.php and add
$regex = apply_filters( 'relevanssi_highlight_regex', $regex, $pr_term );
before this line:
$content .= ' ';
Then you can use this filter hook to modify the regex:
add_filter( 'relevanssi_highlight_regex', function( $regex, $pr_term ) {
return "/($pr_term)/iu";
}, 10, 2 );