Index: apachesolr.index.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Attic/apachesolr.index.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 apachesolr.index.inc
--- apachesolr.index.inc	28 Apr 2009 18:45:25 -0000	1.1.2.2
+++ apachesolr.index.inc	30 Apr 2009 16:23:03 -0000
@@ -28,9 +28,14 @@ function apachesolr_strip_ctl_chars($tex
  * Strip html tags and also control characters that cause Jetty/Solr to fail.
  */
 function apachesolr_clean_text($text) {
-  $text = preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $text);
+  return _apachesolr_strip_decode(preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $text));
+}
+
+function _apachesolr_strip_decode($text) {
   // Add spaces before stripping tags to avoid running words together.
-  return strip_tags(str_replace(array('<', '>'), array(' <', '> '), $text));
+  $text = filter_xss(str_replace(array('<', '>'), array(' <', '> '), $text), array());
+  // Decode entities and then make safe any < or > characters.
+  return str_replace(array('<', '>'), array('&lt;', '&gt;'), html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'));
 }
 
 /**
@@ -83,7 +88,7 @@ function apachesolr_node_to_document($ni
     if (!empty($node->language)) {
       $document->language = $node->language;
     }
-    $document->body = strip_tags(str_replace(array('<', '>'), array(' <', '> '), $text));
+    $document->body = _apachesolr_strip_decode($text);
     $document->type  = $node->type;
     $document->type_name = apachesolr_strip_ctl_chars(node_get_types('name', $node));
     $document->created = apachesolr_date_iso($node->created);
@@ -123,12 +128,13 @@ function apachesolr_node_to_document($ni
         $index_key = apachesolr_index_key($cck_info);
         foreach ($field as $value) {
           // Don't index NULLs or empty strings
-          if (isset($value['safe']) && strlen($value['safe'])) {
+          // We can use 'value' rather than 'safe' since we strip tags and later check_plain().
+          if (isset($value['value']) && strlen($value['value'])) {
             if ($cck_info['multiple']) {
-              $document->setMultiValue($index_key, apachesolr_clean_text($value['safe']));
+              $document->setMultiValue($index_key, apachesolr_clean_text($value['value']));
             }
             else {
-              $document->$index_key = apachesolr_clean_text($value['safe']);
+              $document->$index_key = apachesolr_clean_text($value['value']);
             }
           }
         }
