2021/01/17#p1
I realised pretty quickly that a straight LIKE query wasn't going to work for search as it caught things like parts of URLs where the search term wasn't in the actual text.
Switching to a REGEXP query has resolved this although it took me some time last night to work out the correct regex pattern to exclude what I need. Looking at this introduced me to regex character classes like [:punct:] which came in handy.
This morning I have added highlighting of the search term within results using a preg_replace to only include the correct parts (i.e. not breaking any HTML) in styled <span> tags. If no results are found there is a link to search the archive AKA the WordPress posts.
It's coming together nicely.