Index: apachesolr_biblio.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr_biblio/apachesolr_biblio.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 apachesolr_biblio.admin.inc
--- apachesolr_biblio.admin.inc	23 Sep 2009 12:18:20 -0000	1.1
+++ apachesolr_biblio.admin.inc	6 Nov 2009 10:23:42 -0000
@@ -1,5 +1,5 @@
 <?php
-//$Id: apachesolr_biblio.admin.inc,v 1.1 2009/09/23 12:18:20 robertDouglass Exp $
+
 function apachesolr_biblio_fields_form($form_state) {
   $defaults = apachesolr_biblio_get_fields();
   $form['contributors'] = array(
Index: apachesolr_biblio.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr_biblio/apachesolr_biblio.info,v
retrieving revision 1.1
diff -u -p -r1.1 apachesolr_biblio.info
--- apachesolr_biblio.info	23 Sep 2009 12:18:20 -0000	1.1
+++ apachesolr_biblio.info	6 Nov 2009 10:23:42 -0000
@@ -1,4 +1,4 @@
-; $Id: apachesolr_biblio.info,v 1.1 2009/09/23 12:18:20 robertDouglass Exp $
+; $Id$
 
 name = Apache Solr Biblio
 description = Adds Biblio fields to the Solr index for faceted search
Index: apachesolr_biblio.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr_biblio/apachesolr_biblio.install,v
retrieving revision 1.1
diff -u -p -r1.1 apachesolr_biblio.install
--- apachesolr_biblio.install	23 Sep 2009 12:18:20 -0000	1.1
+++ apachesolr_biblio.install	6 Nov 2009 10:23:42 -0000
@@ -1,5 +1,4 @@
 <?php
-// $Id: apachesolr_biblio.install,v 1.1 2009/09/23 12:18:20 robertDouglass Exp $
 
 function apachesolr_biblio_schema() {
   $schema = array();
Index: apachesolr_biblio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr_biblio/apachesolr_biblio.module,v
retrieving revision 1.1
diff -u -p -r1.1 apachesolr_biblio.module
--- apachesolr_biblio.module	23 Sep 2009 12:18:20 -0000	1.1
+++ apachesolr_biblio.module	6 Nov 2009 10:23:42 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: apachesolr_biblio.module,v 1.1 2009/09/23 12:18:20 robertDouglass Exp $
+// $Id$
 
 function apachesolr_biblio_menu() {
   $items = array();
@@ -65,7 +65,26 @@ function apachesolr_biblio_apachesolr_up
       $value = NULL;
       if ($value = apachesolr_biblio_format_value($node->{$biblio['name']}, $biblio['index_type'])) {
         if (is_array($value)) {
+          // The $biblio_sort variable exists just to build the $sort_index_key.
+          // The $sort_index_key exists so that results can later be sorted
+          // by the first value of this field. Citations often have many
+          // values for fields and we therefore use the first value as the
+          // sort value, building a special field just for this purpose.
+          // TODO: Add a checkbox on the field configuration screen that
+          // indicates whether a field should have a sort, or not.
+          // TODO: Add sorts to the $query object.
+          $biblio_sort = FALSE;
+          if ($biblio['multiple']) {
+            $biblio_sort = $biblio;
+            $biblio_sort['multiple'] = FALSE;
+            $sort_index_key = apachesolr_index_key($biblio_sort);
+          }
+          $first = TRUE;
           foreach($value as $v) {
+            if ($first) {
+              $document->$sort_index_key = $v;
+              $first = FALSE;
+            }
             $document->setMultiValue($index_key, $v);
           }
         }
@@ -78,10 +97,19 @@ function apachesolr_biblio_apachesolr_up
   // Handle authors.
   if (variable_get('apachesolr_biblio_index_authors', 1)) {
     $value = array();
-    foreach ($node->biblio_contributors as $keys) {
-      foreach ($keys as $key) {
-        if (isset($key['name'])) {
-          $document->setMultiValue('sm_biblio_contributors', apachesolr_clean_text($key['name']));
+
+    foreach ($node->biblio_contributors as $arrays) {
+      $first = TRUE;
+      foreach ($arrays as $contributor_node) {
+        if (isset($contributor_node['name'])) {
+          if ($author = trim(apachesolr_clean_text($contributor_node['name']))) {
+            if ($first) {
+              // Set the first name to ss_biblio_first_author
+              $first = FALSE;
+              $document->ss_biblio_first_author = $author;
+            }
+            $document->setMultiValue('sm_biblio_contributors', $author);
+          }
         }
       }
     }
