? .views.module.swp Index: views.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views/views.module,v retrieving revision 1.159.2.2 diff -u -F^f -r1.159.2.2 views.module --- views.module 8 Oct 2006 07:13:35 -0000 1.159.2.2 +++ views.module 8 Nov 2006 12:34:06 -0000 @@ -1802,7 +1802,7 @@ function views_views_style_plugins() { * A list of options to be used in LIKE queries */ function views_handler_operator_like() { - return array('=' => t('Is Equal To'), 'contains' => t('Contains'), 'starts' => t('Starts With'), 'ends' => t('Ends With'), 'not' => t('Does Not Contain')); + return array('=' => t('Is Equal To'), 'contains' => t('Contains'), 'word' => t('Contains Any Word'), 'allwords' => t('Contains All Words'), 'starts' => t('Starts With'), 'ends' => t('Ends With'), 'not' => t('Does Not Contain')); } /** @@ -1826,6 +1826,22 @@ function views_handler_filter_like($op, $query->add_where("UPPER(%s) LIKE UPPER('%%%s%%')", $field, $filter['value']); break; + case 'word': + case 'allwords': + foreach (explode(' ', $filter['value']) as $word) { + $q[] = "UPPER(%s) LIKE UPPER('%%%s%%')"; + $v[] = $field; + $v[] = trim($word, " ,!?"); + } + if ($filter['operator'] == 'word') { + $q = '('. implode(' OR ', $q) .')'; + } + else { + $q = implode(' AND ', $q); + } + array_unshift($v, $q); + call_user_func_array(array($query, 'add_where'), $v); + break; case 'starts': $query->add_where("UPPER(%s) LIKE UPPER('%s%%')", $field, $filter['value']);