View Single Post
  #3  
Old 07-06-2011, 09:39 AM
 
xcart-dev xcart-dev is offline
 

Advanced Member
  
Join Date: Jun 2011
Posts: 59
 

Default Re: Getting Quick Search to do Whole Word Searches

It was indeed include.search.php.

For anyone who stumbles on this thread I wanted to have whole word matches but only in the extra fields. So I changed:

Code:
foreach ($data['extra_fields'] as $k => $v) { $condition[] = '(' . $sql_tbl['extra_field_values'] . '.value LIKE \'%' . $data['substring'] . '%\' AND ' . $sql_tbl['extra_fields'] . '.fieldid = \'' . $k . '\')'; }

To:
Code:
foreach ($data['extra_fields'] as $k => $v) { $condition[] = '(' . $sql_tbl['extra_field_values'] . '.value REGEXP \'[[:<:]]' . $data['substring'] . '[[:>:]]\' AND ' . $sql_tbl['extra_fields'] . '.fieldid = \'' . $k . '\')'; }

The Regexp now demands that only whole words are found rather than words 'like'
__________________
X-Cart 4.4.3
Reply With Quote