Several important commits:
authorJoshua Ferraro <jmf@liblime.com>
Sun, 23 Dec 2007 00:25:50 +0000 (19:25 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Sun, 23 Dec 2007 00:26:39 +0000 (18:26 -0600)
  * adding zebra daemons for managing server and queue processes
  * improvements to the README.debian file
  * Fixes to Search.pm since last series of commits broke zebra-based
    searching (again)
  * moving some files to new misc/bin and misc/cronjobs

Signed-off-by: Joshua Ferraro <jmf@liblime.com>

C4/Search.pm
README.debian
installer/data/mysql/en/mandatory/sysprefs.sql
misc/bin/koha-zebra-ctl.sh [new file with mode: 0755]
misc/bin/koha-zebraqueue-ctl.sh [new file with mode: 0755]
misc/bin/zebraqueue_daemon.pl [moved from misc/zebraqueue_daemon.pl with 100% similarity]
misc/cronjobs/backup.sh [moved from misc/backup.sh with 100% similarity]

index 12ba395..c4ee370 100644 (file)
@@ -402,6 +402,7 @@ sub getRecords {
     while ( ( my $i = ZOOM::event( \@zconns ) ) != 0 ) {
         my $ev = $zconns[ $i - 1 ]->last_event();
         if ( $ev == ZOOM::Event::ZEND ) {
+           next unless  $results[ $i - 1 ];
             my $size = $results[ $i - 1 ]->size();
             if ( $size > 0 ) {
                 my $results_hash;
@@ -660,8 +661,8 @@ sub _build_weighted_query {
         $weighted_query .= " or ti,phr,r3=\"$operand\"";            # phrase title
        #$weighted_query .= " or any,ext,r4=$operand";               # exact any
        #$weighted_query .=" or kw,wrdl,r5=\"$operand\"";            # word list any
-        $weighted_query .= " or wrd,fuzzy,r8=\"$operand\"" if $fuzzy_enabled; # add fuzzy, word list
-        $weighted_query .= " or wrd,right-Truncation,r9=\"$stemmed_operand\"" if ($stemming and $stemmed_operand); # add stemming, right truncation
+        $weighted_query .= " or wrdl,fuzzy,r8=\"$operand\"" if $fuzzy_enabled; # add fuzzy, word list
+        $weighted_query .= " or wrdl,right-Truncation,r9=\"$stemmed_operand\"" if ($stemming and $stemmed_operand); # add stemming, right truncation
        # embedded sorting: 0 a-z; 1 z-a
        # $weighted_query .= ") or (sort1,aut=1";
     }
@@ -890,10 +891,10 @@ sub buildQuery {
        if ($group_OR_limits) {
                $limit.=" and " if ($query || $limit );
                $limit.="($group_OR_limits)";
-       }
+       } 
        if ($availability_limit) {
-               $limit.=" not " if ($query || $limit );
-               $limit.="$availability_limit";
+               $limit.=" and " if ($query || $limit );
+               $limit.="($availability_limit)";
        }
        # normalize the strings
        $query =~ s/:/=/g;
index 1ebd7c2..15da926 100644 (file)
@@ -5,7 +5,7 @@ Installation Guide for Installing Koha on Debian Etch with MySQL 5
 Copyright (C) 2007, LibLime
 
 Maintainer: Joshua Ferraro (jmf AT liblime DOT com)
-Feedback/bug reports: jmf@liblime.com
+Feedback/bug reports: jmf AT liblime DOT com
 This document last modified: 22 December 2007
 
 Installation Instructions
@@ -151,16 +151,41 @@ When the configuration is completed CPAN will install the Perl modules.
     $ sudo a2enmod rewrite
     $ sudo a2ensite koha && /etc/init.d/apache2 reload
 
-5. start Zebra, reload Apache2 config
+5. Configure and start Zebra
 
-    $ sudo su <zebrauser>
-    $ zebrasrv -f /etc/koha/koha-conf.xml
+Note: it's recommended that you daemonize the Zebra process and add it to your
+startup profile. For a non-production test/development installation, running 
+Zebra from the command line can be useful. Pick from the two available options
+below, or roll your own :-)
+
+Note: it's also recommended that you create a Koha system user, which you will
+have specified during the install process. Alternatively, Zebra can be
+configured to run as the root user.
+
+Option 1: run the Zebra processes from the command line:
+
+    Zebra Server:
+    $ sudo ${KOHA_USER} zebrasrv -f /etc/koha/koha-conf.xml
     (note that the path to koha-conf.xml may be different depending on your
     installation choices)
 
-Note: it's recommended that you daemonize the Zebra process and add it to your
-startup profile. For a non-production test/development installation, running 
-Zebra from the command line can be useful.
+    Zebraqueue Daemon:
+    $ sudo ${KOHA_USER} misc/bin/zebraqueue_daemon.pl
+
+Option 2: run the Zebra processes as daemons, and add to startup process:
+
+    Zebra Server:
+    $ sudo ln -s misc/bin/koha-zebra-ctl.sh  /etc/init.d/koha-zebra-daemon
+    $ update-rc.d koha-zebra-daemon defaults
+    ( Note: see man chkconfig(8) on other distros )
+    $ misc/bin/koha-zebra-ctl.sh start
+
+    Zebraqueue Daemon:
+    $ sudo ln -s misc/bin/koha-zebraqueue-ctl.sh  /etc/init.d/koha-zebraqueue-daemon
+    $ update-rc.d koha-zebraqueue-daemon defaults 
+    ( Note: see man chkconfig(8) on other distros )
+
+    $ misc/bin/koha-zebraqueue-ctl.sh start
 
 6. Run the Web Installer, populate the database, initial configuration of settings
 
@@ -181,7 +206,7 @@ Tested on the following operating environments
 
 Installer Bug reports
 =====================
-Please send any installer bug reports to jmf@liblime.com
+Please send any installer bug reports to jmf AT liblime DOT com
 
 Other Notes
 =====================
index 5ba06ee..35025b9 100644 (file)
@@ -110,7 +110,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SessionStorage','mysql','Use database or a temporary file for storing session data','mysql|Pg|tmp','Choice');  
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('CircAutocompl','1','If ON, autocompletion is enabled for the Circulation input',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingSerials','1','If ON, serials routing is enabled',NULL,'YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SearchMyLibraryFirst','1','If ON, OPAC searches return results limited by the user\'s library by default if they are logged in',NULL,'YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SearchMyLibraryFirst','0','If ON, OPAC searches return results limited by the user\'s library by default if they are logged in',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('dontmerge','1','If ON, modifying an authority record will not update all associated bibliographic records immediately, ask your system administrator to enable the merge_authotities.pl cron job',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BiblioAddsAuthorities','0','If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('QueryStemming','1','If ON, enables query stemming',NULL,'YesNo');
diff --git a/misc/bin/koha-zebra-ctl.sh b/misc/bin/koha-zebra-ctl.sh
new file mode 100755 (executable)
index 0000000..cc284c3
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+USER=__KOHA_USER__
+GROUP=__KOHA_GROUP__
+NAME=koha-zebra-ctl
+LOGDIR=__LOG_DIR__
+ERRLOG=$LOGDIR/koha-zebradaemon.err
+STDOUT=$LOGDIR/koha-zebradaemon.log
+OUTPUT=$LOGDIR/koha-zebradaemon-output.log
+KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
+# you may need to change this depending on where zebrasrv is installed
+ZEBRASRV=/usr/bin/zebrasrv
+
+test -f $ZEBRASRV || exit 0
+
+case "$1" in
+    start)
+      echo "Starting Zebra Server"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP -- $ZEBRASRV -f $KOHA_CONF 
+      ;;
+    stop)
+      echo "Stopping Zebra Server"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --stop -- $ZEBRASRV -f $KOHA_CONF 
+      ;;
+    restart)
+      echo "Restarting the Zebra Server"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --restart -- $ZEBRASRV -f $KOHA_CONF 
+      ;;
+    *)
+      echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
+      exit 1
+      ;;
+esac
diff --git a/misc/bin/koha-zebraqueue-ctl.sh b/misc/bin/koha-zebraqueue-ctl.sh
new file mode 100755 (executable)
index 0000000..f1dff66
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+USER=__KOHA_USER__
+GROUP=__KOHA_GROUP__
+NAME=koha-zebraqueue-ctl
+LOGDIR=__LOG_DIR__
+PERL5LIB=__PERL_MODULE_DIR__
+KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
+ERRLOG=$LOGDIR/koha-zebraqueue.err
+STDOUT=$LOGDIR/koha-zebraqueue.log
+OUTPUT=$LOGDIR/koha-zebraqueue-output.log
+KOHA_CONF=/home/jmf/koha-dev/etc/koha-conf.xml
+export KOHA_CONF
+export PERL5LIB
+ZEBRAQUEUE=__PERL_MODULE_DIR__/misc/bin/zebraqueue_daemon.pl
+
+test -f $ZEBRAQUEUE || exit 0
+
+case "$1" in
+    start)
+      echo "Starting Zebraqueue Daemon"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF 
+      ;;
+    stop)
+      echo "Stopping Zebraqueue Daemon"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --stop -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF 
+      ;;
+    restart)
+      echo "Restarting the Zebraqueue Daemon"
+      daemon --name=$NAME --errlog=$ERRLOG --stdout=$STDOUT --output=$OUTPUT --verbose=1 --respawn --delay=30 --user=$USER.$GROUP --restart -- perl -I $PERL5LIB $ZEBRAQUEUE -f $KOHA_CONF 
+      ;;
+    *)
+      echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
+      exit 1
+      ;;
+esac
similarity index 100%
rename from misc/backup.sh
rename to misc/cronjobs/backup.sh