From a5063d245af919c25d56995fe71fd927a6ffb58d Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Fri, 11 Apr 2014 09:58:17 -0400
Subject: [PATCH] Added optional sort fields to Solr connection in VuDL.

---
 module/VuDL/src/VuDL/Connection/Solr.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/module/VuDL/src/VuDL/Connection/Solr.php b/module/VuDL/src/VuDL/Connection/Solr.php
index 6abcc03402a..5fa03b15515 100644
--- a/module/VuDL/src/VuDL/Connection/Solr.php
+++ b/module/VuDL/src/VuDL/Connection/Solr.php
@@ -206,19 +206,24 @@ class Solr extends AbstractBase
     /**
      * Returns file contents of the structmap, our most common call
      *
-     * @param string $id record id
+     * @param string $id         record id
+     * @param array  $extra_sort extra fields to sort on
      *
      * @return string $id
      */
-    public function getOrderedMembers($id)
+    public function getOrderedMembers($id, $extra_sort = array())
     {
         // Try to find members in order
         $seqField = 'sequence_'.str_replace(':', '_', $id).'_str';
+        $sort = array($seqField.' asc');
+        foreach ($extra_sort as $sf) {
+            $sort[] = $sf;
+        }
         $response = $this->search(
             new ParamBag(
                 array(
                     'q'  => 'relsext.isMemberOf:"'.$id.'"',
-                    'sort'  => $seqField.' asc,fgs.label asc',
+                    'sort'  => implode(',', $sort),
                     'fl' => 'id',
                     'rows' => 99999,
                 )
-- 
GitLab