From 6d13d446558d4c550bfb8a34c5e451ce158ad097 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Wed, 19 Dec 2007 20:28:13 -0600 Subject: [PATCH] Fixed buggy NoZebra cataloguing search when search term does not exist in any record. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Search.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 9dfef9d2f0..8407f2ee80 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -204,7 +204,8 @@ sub SimpleSearch { my $query = shift; if (C4::Context->preference('NoZebra')) { my $result = NZorder(NZanalyse($query))->{'biblioserver'}->{'RECORDS'}; - return (undef,$result); + my $search_result = ( $result->{hits} && $result->{hits} > 0 ? $result : [] ); + return (undef,$search_result); } else { my @servers = @_; my @results; @@ -1428,7 +1429,7 @@ sub NZanalyse { } } } -# warn "return : $results for LEAF : $string" if $DEBUG; + warn "return : $results for LEAF : $string" if $DEBUG; return $results; } } @@ -1444,6 +1445,7 @@ sub NZanalyse { sub NZorder { my ($biblionumbers, $ordering,$results_per_page,$offset) = @_; + warn "biblionumbers = $biblionumbers and ordering = $ordering\n" if $DEBUG; # order title asc by default # $ordering = '1=36