[Koha-patches] [PATCH] OPAC new subjects cloud: allow utf8 characters

Frederic Demians f.demians at tamil.fr
Wed Oct 1 20:06:16 CEST 2008


Allow utf8 characters and deal with a ZOOM bug
---
 tools/create_cloud.pl |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/create_cloud.pl b/tools/create_cloud.pl
index 759e680..2afcc64 100755
--- a/tools/create_cloud.pl
+++ b/tools/create_cloud.pl
@@ -100,14 +100,23 @@ sub zebra_top_terms {
     my $min_occurence;
     my $from = '0';
     while (1) {
-        my $query = '@attr 1=' . $index_name . ' @attr 4=1 @attr 6=3 "'
-                    . $from . '"';
-        my $ss = $zbiblio->scan_pqf( $query );
+        my $ss;
+        eval {
+            my $query = '@attr 1=' . $index_name . ' @attr 4=1 @attr 6=3 "'
+                        . $from . '"';
+            #print "query: $query\n";
+            $ss = $zbiblio->scan_pqf( $query );
+        };
+        if ($@) {
+            chop $from;
+            next;
+        }
+        $ss->option( rpnCharset => 'UTF-8' );
         last if $ss->size() == 0;
         my $term = '';
         my $occ = 0;
         for my $index ( 0..$ss->size()-1 ) {
-            ($term, $occ) = $ss->term($index);
+            ($term, $occ) = $ss->display_term($index);
             if ( $number_of_terms < $max_terms ) {
                 push( @terms, [ $term, $occ ] ); 
                 ++$number_of_terms;
-- 
1.5.5.GIT




More information about the Koha-patches mailing list