Index: schema.xml
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/schema.xml,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 schema.xml
--- schema.xml	14 Jun 2008 18:44:29 -0000	1.1.2.2
+++ schema.xml	6 Aug 2008 00:55:03 -0000
@@ -216,6 +216,22 @@
       </analyzer>
     </fieldType>
 
+    <fieldType name="spellText" class="solr.TextField" positionIncrementGap="100">
+     <analyzer type="index">
+       <tokenizer class="solr.StandardTokenizerFactory"/>
+       <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
+       <filter class="solr.StandardFilterFactory"/>
+       <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
+     </analyzer>
+     <analyzer type="query">
+       <tokenizer class="solr.StandardTokenizerFactory"/>
+       <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
+       <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
+       <filter class="solr.StandardFilterFactory"/>
+       <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
+     </analyzer>
+    </fieldType>
+
     <!-- since fields of this type are by default not stored or indexed, any data added to
          them will be ignored outright
      -->
@@ -256,6 +272,7 @@
    <field name="vid"  type="integer" indexed="true" stored="true" multiValued="true"/>
    <field name="taxonomy_name" type="string" indexed="true" stored="true" multiValued="true"/>
    <field name="text" type="text" indexed="true" stored="false"/>
+   <field name="word" type="spellText" indexed="true" stored="true" />
 
 
    <!-- Here, default is used to create a "timestamp" field indicating
@@ -296,6 +313,8 @@
    <dynamicField name="*" type="ignored" />
 
  </fields>
+ 
+ <copyField source="text" dest="word" />
 
  <!-- Field to use to determine and enforce document uniqueness.
       Unless this field is marked with required="false", it will be a required field
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 apachesolr_search.module
--- apachesolr_search.module	19 Jul 2008 14:22:43 -0000	1.1.2.11
+++ apachesolr_search.module	6 Aug 2008 00:55:03 -0000
@@ -101,6 +101,31 @@ function apachesolr_search_search($op = 
                                'score' => $doc->score,
                                'snippet' => $snippet);
           }
+        } else {
+          // No results
+          // Try to show spelling suggestions
+          $host = variable_get('apachesolr_host', 'localhost');
+          $port = variable_get('apachesolr_port', 8983);
+          $path = variable_get('apachesolr_path', '/solr');
+          #$query = $query->get_query();
+          #http://example.com:8983/solr/select?qt=spellchecker&q=[word]
+          $request = "http://{$host}:{$port}{$path}/select?qt=spellchecker&q=". rawurlencode(check_plain($keys));
+          $result = drupal_http_request($request);
+          if (preg_match_all('/<str>(.*?)<\/str>/', $result->data, $matches)) {
+            $suggestions = $matches[1];
+            foreach($suggestions as $s) {
+              $results[] = array('link' => url('search/apachesolr_search/'. $s, NULL, NULL, TRUE),
+                               'type' => NULL,
+                               'title' => t("No results-- did you mean '@suggestion'?", array('@suggestion' => $s)),
+                               'user' => NULL,
+                               'date' => NULL,
+                               'node' => NULL,
+                               #'extra' => NULL,
+                               'score' => 0,
+                               'snippet' => t('Your search yielded no results'). search_help('search#noresults'));
+              break;
+            }
+          }
         }
         // Set breadcrumb
         drupal_set_breadcrumb($query->get_breadcrumb());
