Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.81
diff -u -p -r1.1.2.12.2.81 apachesolr.module
--- apachesolr.module	19 Dec 2008 04:14:06 -0000	1.1.2.12.2.81
+++ apachesolr.module	23 Dec 2008 02:09:32 -0000
@@ -475,9 +475,12 @@ function apachesolr_node_to_document($ni
     $document->title = $node->title;
     $document->body = strip_tags($text);
     $document->type  = $node->type;
-    $document->type_name = node_get_types('name', $node);
-    $document->changed = apachesolr_date_iso($node->changed + rand(1000,10000));
-    $document->comment_count = $node->comment_count;
+    $document->type_name = apachesolr_strip_ctl_chars(node_get_types('name', $node));
+    $document->created = apachesolr_date_iso($node->created);
+    $document->changed = apachesolr_date_iso($node->changed);
+    $last_change = (isset($node->last_comment_timestamp) && $node->last_comment_timestamp > $node->changed) ? $node->last_comment_timestamp : $node->changed;
+    $document->last_comment_or_change = apachesolr_date_iso($last_change);
+    $document->comment_count = isset($node->comment_count) ? $node->comment_count : 0;
     $document->name = apachesolr_strip_ctl_chars($node->name);
     $document->language = $node->language;
 
@@ -539,14 +542,6 @@ function apachesolr_date_iso($date_times
 }
 
 /**
- * Convert date from ISO 8601 format into timestamp.
- */
-function apachesolr_date_timestamp($date_iso) {
-  return strtotime($date_iso);
-}
-
-
-/**
  * Extract taxonomy from $node and add to dynamic fields.
  */
 function apachesolr_add_taxonomy_to_document(&$document, $node) {
@@ -663,7 +658,7 @@ function apachesolr_nodeapi(&$node, $op,
       db_query("INSERT INTO {apachesolr_search_node} (nid, status, changed) VALUES  (%d, %d, GREATEST(%d, %d))", $node->nid, $node->status, $node->created, $node->changed);
       break;
     case 'update':
-      // Check if th enode has gone from published to unpublished.
+      // Check if the node has gone from published to unpublished.
       If (!$node->status && db_result(db_query("SELECT status FROM {apachesolr_search_node} WHERE nid = %d", $node->nid))) {
         apachesolr_delete_node_from_index($node);
       }
@@ -707,7 +702,7 @@ function apachesolr_block($op = 'list', 
               'stitle' => array('name' => t('Title'), 'default' => 'asc'),
               'type' => array('name' => t('Type'), 'default' => 'asc'),
               'name' => array('name' => t('Author'), 'default' => 'asc'),
-              'changed' => array('name' => t('Date'), 'default' => 'desc'),
+              'created' => array('name' => t('Date'), 'default' => 'desc'),
             );
 
             $solrsorts = array();
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.54
diff -u -p -r1.1.2.6.2.54 apachesolr_search.module
--- apachesolr_search.module	19 Dec 2008 04:14:06 -0000	1.1.2.6.2.54
+++ apachesolr_search.module	23 Dec 2008 02:09:32 -0000
@@ -82,7 +82,7 @@ function apachesolr_search_search($op = 
         $results = array();
 
         $params = array(
-          'fl' => 'id,nid,title,comment_count,type,changed,score,url,uid,name',
+          'fl' => 'id,nid,title,comment_count,type,created,changed,score,url,uid,name',
           'rows' => variable_get('apachesolr_rows', 10),
           'facet' => 'true',
           'facet.mincount' => 1,
@@ -181,7 +181,7 @@ function apachesolr_search_search($op = 
         // rord() returns 1 for the newset doc, and the number in the index for
         // the oldest doc.  The function is thus: $total/(rord()*$steepness + $total).
         if ($date_boost) {
-          $params['bf'][] = "recip(rord(changed),$date_steepness,$total,$total)^$date_boost";
+          $params['bf'][] = "recip(rord(created),$date_steepness,$total,$total)^$date_boost";
         }
         $comment_settings = variable_get('apacehsolr_search_comment_boost', '4:200.0');
         list($comment_steepness, $comment_boost) = explode(':', $comment_settings);
@@ -212,6 +212,8 @@ function apachesolr_search_search($op = 
             if (!isset($doc->body)) {
               $doc->body = $snippet;
             }
+            $doc->created = strtotime($doc->created);
+            $doc->changed = strtotime($doc->changed);
             $extra += node_invoke_nodeapi($doc, 'search result');
             $extra['score'] = $doc->score;
             $results[] = array(
@@ -219,7 +221,7 @@ function apachesolr_search_search($op = 
               'type' => node_get_types('name', $doc),
               'title' => $doc->title,
               'user' => theme('username', $doc),
-              'date' => apachesolr_date_timestamp($doc->changed),
+              'date' => $doc->created,
               'node' => $doc,
               'extra' => $extra,
               'score' => $doc->score,
Index: schema.xml
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/schema.xml,v
retrieving revision 1.1.2.1.2.18
diff -u -p -r1.1.2.1.2.18 schema.xml
--- schema.xml	18 Dec 2008 10:41:16 -0000	1.1.2.1.2.18
+++ schema.xml	23 Dec 2008 02:09:32 -0000
@@ -253,7 +253,9 @@
    <field name="path" type="text" indexed="true" stored="true" termVectors="true"/>
    <field name="uid"  type="integer" indexed="true" stored="true"/>
    <field name="name" type="text" indexed="true" stored="true" termVectors="true"/>
+   <field name="created" type="date" indexed="true" stored="true"/>
    <field name="changed" type="date" indexed="true" stored="true"/>
+   <field name="last_comment_or_change" type="date" indexed="true" stored="true"/>
    <field name="nid"  type="integer" indexed="true" stored="true"/>
    <field name="status" type="integer" indexed="true" stored="true"/>
    <field name="comment_count" type="integer" indexed="true" stored="true"/>
