--- custom_search.orig.module	2010-11-18 17:32:55.000000000 +0100
+++ custom_search.module	2010-11-18 17:34:24.000000000 +0100
@@ -71,7 +71,7 @@ function custom_search_perm() {
  */
 function custom_search_form_alter(&$form, $form_state, $form_id) {
   if (user_access('use custom search')) {
-
+  
     // Filter the form_id value to identify all the custom blocks
     $form_id_processed = $form_id;
     $delta = '';
@@ -79,6 +79,15 @@ function custom_search_form_alter(&$form
       if ($form_id == 'custom_search_blocks_form_' . $a) {
         $form_id_processed = 'custom_search_blocks_form';
         $delta = 'blocks_' . $a . '_';
+        if (function_exists('apachesolr_autocomplete_variable_get_widget')) {
+          // support for apachesolr_autocomplete module
+          if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
+            $form['custom_search_blocks_form_' . $a]['#attributes']['class'] .= ' apachesolr-autocomplete unprocessed';
+          }
+          else {
+            $form['custom_search_blocks_form_' . $a]['#autocomplete_path'] = 'apachesolr_autocomplete';
+          }
+        }
       }
     }
 
