diff --git a/custom_search.module b/custom_search.module
index fbc0657..7457543 100644
--- a/custom_search.module
+++ b/custom_search.module
@@ -442,7 +442,12 @@ function custom_search_submit($form, &$form_state) {
   $delta = (isset($form_state['values']['delta'])) ? 'blocks_' . $form_state['values']['delta'] . '_' : '';
   variable_set('custom_search_delta', $delta);
   $type = 'node';
-  $keys = $form_state['values'][$form_state['values']['form_id']];
+  $keys = trim($form_state['values'][$form_state['values']['form_id']]);
+
+  if (variable_get('custom_search_' . $delta . 'operator', 'AND') == 'OR') {
+    $keys = preg_replace("/(\s+)/", " OR ", $keys);
+  }
+
   $original_keywords = $keys;
 
   $types = (isset($form_state['values']['custom_search_types'])) ? $form_state['values']['custom_search_types'] : array();
diff --git a/includes/forms.inc b/includes/forms.inc
index fba8d94..27dfcaa 100644
--- a/includes/forms.inc
+++ b/includes/forms.inc
@@ -57,6 +57,16 @@ function _custom_search_default_admin_form($delta = '') {
       '#description'    => t('The default value is "text".'),
     );
   }
+  $form['search_box']['custom_search_' . $delta . 'operator'] = array(
+    '#type'           => 'select',
+    '#title'          => t('Search operator'),
+    '#options'        => array(
+      'AND' => t('AND'),
+      'OR'  => t('OR'),
+    ),
+    '#default_value'  => variable_get('custom_search_' . $delta . 'operator', 'AND'),
+    '#description'    => t('The default value is "AND", and will search for results containing ALL the words. Choose "OR" to search for results containing ANY of the words.'),
+  );
   $form['search_box']['custom_search_' . $delta . 'size'] = array(
     '#type'           => 'textfield',
     '#title'          => t('Search box size'),
