Thread Starter
Aida G
(@aidag)
I changed regexp for highlighting and it works:
Regexp before: "/($pr_term)(?!(^&+)?(;))/iu"
and
Regexp now: "/\b($pr_term)\b/"
I made changes in excerpts-highlights.php
You didn’t change what you thought you changed. Relevanssi does not actually search within words, just the highlighting works that way.
Also, changing that regexp may cause problems with particular search terms; the mess of characters in the end of the first regexp is there for a reason.
Thread Starter
Aida G
(@aidag)
do you have any suggestion what can I do with highlighting without changing that regexp, pls?
If you disable fuzzy searching (which it seems you don’t like), Relevanssi actually uses this regexp to highlight terms: /(\b$pr_term|$pr_term\b)(?!(^&+)?(;))/iu`
So, looks like that is what you want.
Thread Starter
Aida G
(@aidag)
I tried choosing ‘Don’t use fuzzy search’ option from dropdown, but no success it still highlights letters from word. Any other solution?
There’s no option to stop that completely, if you only want to highlight complete words you need to change the regexp in Relevanssi to this:
/(\b$pr_term\b)(?!(^&+)?(;))/iu