Index: views_fastsearch.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_fastsearch/views_fastsearch.module,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 views_fastsearch.module
--- views_fastsearch.module	5 Feb 2007 15:08:34 -0000	1.1.2.3
+++ views_fastsearch.module	5 Feb 2007 17:22:06 -0000
@@ -41,8 +41,9 @@
     'filters' => array(
       'word' => array(
         'name' => t('Search: Fast Index'),
-        'operator' => array('=' => t('Contains')),
+        'operator' => array("CUSTOM" => "CUSTOM", "AND" => "AND", "OR" => "OR"),
         'handler' => 'views_fastsearch_views_handler_search_index',
+        'option' => 'string',
         'help' => t('This filter allows nodes to be filtered quickly using limited search module features'),
       ),
     ),
@@ -84,14 +85,16 @@
       // walk through each of the values
       // building the AND, OR, and exclusion terms
       $values = explode(' ', $filter['value']);
+      $word_count = 0;
       foreach ($values as $value) {
+        $word_count++;
         // OR applies to the next value only
-        if (strtoupper($value) == 'OR') {
+        if (strtoupper($value) == 'OR' && $filter['operator'] != "AND") {
           $sqlop = ' OR ';
           continue;
         }
 
-        if ($sqlop == ' OR ') {
+        if ($sqlop == ' OR ' || ($filter['operator'] == "OR" && $word_count > 1)) {
           $or_values[] = $value;
         }
         else { // implied AND
@@ -102,8 +105,8 @@
             }
             else {
               $tnc = $query->add_table('search_dataset', true);
-              $tnc = intval($tnc) > 1 ? $tnc: "";
-              $and_clause[] = "search_dataset$tnc.data like '%%%s%%'";
+              $tablename = $query->get_table_name('search_index', $tnc);
+              $and_clause[] = "$tablename.data like '%%%s%%'";
               $arguments[] = $quote_value . ' ' . substr($value, 0, -1);
               unset($in_quote);
             }
@@ -128,9 +131,13 @@
               // FALLTHROUGH
             default:
               $tnc = $query->add_table('search_index', true);
-              $tnc = intval($tnc) > 1 ? $tnc: "";
-              $and_clause[] = "search_index$tnc.word = '%s'";
+              $tablename = $query->get_table_name('search_index', $tnc);        
+              $and_clause[] = "$tablename.word = '%s'";
               $arguments[] = $value;
+              if ($filter['options']) {
+                $tablename = $query->get_table_name('search_index', $tnc);
+                $query->add_where("$tablename.type = '%s'",$filter['options']);
+              }
               break;
           }
         }
@@ -149,7 +156,6 @@
           $conditions[] = '(' . implode(' AND ', $and_clause) . ')';
           $arguments = array_merge($arguments, array_fill(0, count($and_clause), $value));
         }
-        $query->set_distinct();
       }
       $query->add_where(implode(' OR ', $conditions), $arguments);
 
