UPDATE: In AjaxSearch 1.9.2 it’s integrated and all you need to do is: &advSearch=`exactphrase`
Here is what I needed to do:
search.class.inc.php
<?php //for highlighting
function getWhereForm($advSearch){
$whereForm = array(
'like' => " LIKE '% word %'",
'notlike' => " NOT LIKE '% word %'"
);
--> Add SPACES around %word%
...This is even better:
<?php // for highlighting
function getWhereForm($advSearch){
$whereForm = array(
'like' => " REGEXP '[[:<:]]word[[:>:]]'",
'notlike' => " NOT REGEXP '[[:<:]]word[[:>:]]'"
);
Othervise won’t show words like <p>word
Yes, it now works for 'exactphrase' in version 1.9.2.
However, I wanted my search to work with 'allwords', but only match full words, so I tried the recommended code hack (above)...
This seems to work when NO sub-string matches would be returned (eg: a search for 'erefo' will return nothing even though it occurs in 'therefore'). However, if there is *at least one result* for the search term, it will return *all* the sub-string matches (eg: a search for 'the' will return 'therefore', 'bathed', 'catheter' etc as well as 'the').
I edited line 568 of the ajaxSearchRequest.class.inc.php file - I assume this is what mrhaw meant. I also kinda assumed the following key should be added to the array, as it's referred to a couple of lines later:
'regexp' => " REGEXP '[[:<:]]word[[:>:]]'"
Has anyone else found this problem? Any solutions?