[Koha-patches] [PATCH] [SIGNED-OFF] Bug 4393: Scan Indexes results cannot be sorted

Nicole C. Engard nengard at bywatersolutions.com
Sat Mar 26 11:01:51 CET 2011


From: Jared Camins-Esakov <jcamins at bywatersolutions.com>

Because of the way Scan Indexes works, the results cannot be sorted. Previously
when any sort other than relevance (or in some cases popularity) was used, the
search failed. This patch disables sorting on Scan results. This patch also
fixes the index selection dropdown on the results page, which was not being
populated correctly from the Advanced Search screen.

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
 C4/Search.pm        |    2 +-
 catalogue/search.pl |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index b698a93..f658e5c 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -391,7 +391,7 @@ sub getRecords {
                 warn "Ignoring unrecognized sort '$sort' requested" if $sort_by;
             }
         }
-        if ($sort_by) {
+        if ($sort_by && !$scan) {
             if ( $results[$i]->sort( "yaz", $sort_by ) < 0 ) {
                 warn "WARNING sort $sort_by failed";
             }
diff --git a/catalogue/search.pl b/catalogue/search.pl
index b22837a..9a8ac25 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -383,7 +383,7 @@ my @indexes;
 @indexes = split("\0",$params->{'idx'});
 
 # if a simple index (only one)  display the index used in the top search box
-if ($indexes[0] && !$indexes[1]) {
+if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
     $template->param("ms_".$indexes[0] => 1);}
 
 
-- 
1.7.2.3



More information about the Koha-patches mailing list