From 9133617c1932f9522645d4dcd347f35a3159a70b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 8 Aug 2013 15:15:53 -0300 Subject: [PATCH] Bug 8507: koha-create should be updated to use DOM indexing for bib This patch makes the koha-create script install the file zebra-biblios-dom.cfg with the proper string substitutions inside on the new instance. It also adds two option switches that control the indexing mode for the instance: --biblio-idx {dom|grs1} --auth-idx {dom|grs1} DOM indexing is set as the default for both authorities and bibliographic records. To test: - Apply the patch - Build your own packages and install them on a test server a) Create a new instance without using the new switches like: $ koha-create --create-db domtest - Check there's a file /etc/koha/sites/domtest/zebra-biblios-dom.cfg - Check that /etc/koha/sites/domtest/koha-conf.xml points to: * zebra-biblios-dom.cfg (biblioserver section) * zebra-biblios-dom.cfg (publicserver section) * zebra-authorities-dom.cfg (authorityserver section) - Success means the new default is DOM b) Play with the 4 possible combination of option switches $ koha-create --create-db --auth-idx grs1 --biblio-idx grs1 domtest $ koha-create --create-db --auth-idx grs1 --biblio-idx dom domtest $ koha-create --create-db --auth-idx dom --biblio-idx grs1 domtest $ koha-create --create-db --auth-idx dom --biblio-idx dom domtest - Check the koha-conf.xml file reflects the chosen options. c) Run $ koha-create --help - It should advertise this addition accordingly. d) Run $ man koha-create - Man page for koha-create should provide good information on the new switches behaviour Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- debian/docs/koha-create.xml | 16 +++++++++++ debian/scripts/koha-create | 46 +++++++++++++++++++++++++++++++- debian/templates/koha-conf-site.xml.in | 6 ++--- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 491da62..31c168a 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -27,6 +27,8 @@ ||| marc21|normarc|unimarc en|es|fr|nb|ru|uk + dom|grs1 + dom|grs1 /path/to/some.sql /path/to/config /path/to/passwd @@ -109,6 +111,20 @@ + + + + Specified the desired indexing mode for authority records. Valid options are (default) and . + + + + + + + Specified the desired indexing mode for bibliographic records. Valid options are (default) and . + + + diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index a0a830a..811e36f 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -22,6 +22,7 @@ set -e usage="Usage: $0 [--create-db|--request-db|--populate-db|--use-db] \ [--marcflavor marc21|normarc|unimarc] \ [--zebralang en|es|fr|nb|ru|uk] \ + [--auth-idx dom|grs1] [--biblio-idx dom|grs1] \ [--defaultsql /path/to/some.sql] \ [--configfile /path/to/config] [--passwdfile /path/to/passwd] \ [--database database] [--adminuser n] instancename" @@ -45,6 +46,8 @@ generate_config_file() { -e "s/__ZEBRA_PASS__/$zebrapwd/g" \ -e "s/__ZEBRA_MARC_FORMAT__/$ZEBRA_MARC_FORMAT/g" \ -e "s/__ZEBRA_LANGUAGE__/$ZEBRA_LANGUAGE/g" \ + -e "s/__BIBLIO_INDEXING__/$BIBLIO_INDEXING/g" \ + -e "s/__AUTHORITY_INDEXING__/$AUTHORITY_INDXING/g" \ -e "s/__DB_NAME__/$mysqldb/g" \ -e "s/__DB_HOST__/$mysqlhost/g" \ -e "s/__DB_USER__/$mysqluser/g" \ @@ -75,6 +78,40 @@ getinstancemysqldatabase() { xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml" } +set_authority_indexing() +{ + indexing_mode=$1 + + case $indexing_mode in + "grs1") + AUTHORITY_INDEXING="" + ;; + "dom") + AUTHORITY_INDEXING="-dom" + ;; + *) + die "Error: '$indexing_mode' is not a valid indexing mode for authority records." + ;; + esac +} + +set_biblio_indexing() +{ + indexing_mode=$1 + + case $indexing_mode in + "grs1") + BIBLIO_INDEXING="" + ;; + "dom") + BIBLIO_INDEXING="-dom" + ;; + *) + die "Error: '$indexing_mode' is not a valid indexing mode for bibliographic records." + ;; + esac +} + # Set defaults and read config file, if it exists. DOMAIN="" OPACPORT="80" @@ -86,6 +123,8 @@ INTRASUFFIX="" DEFAULTSQL="" ZEBRA_MARC_FORMAT="marc21" ZEBRA_LANGUAGE="en" +BIBLIO_INDEXING="-dom" +AUTHORITY_INDEXING="-dom" ADMINUSER="1" PASSWDFILE="/etc/koha/passwd" if [ -e /etc/koha/koha-sites.conf ] @@ -95,7 +134,8 @@ fi [ $# -ge 2 ] && [ $# -le 16 ] || die $usage -TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,marcflavor:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser: \ +TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,marcflavor:,\ + auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser: \ -n "$0" -- "$@"` # Note the quotes around `$TEMP': they are essential! @@ -115,6 +155,8 @@ while true ; do -u|--use-db) op=use ; shift ;; -m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;; -l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; + --auth-idx) set_authority_indexing "$2" ; shift 2 ;; + --biblio-idx) set_biblio_indexing "$2" ; shift 2 ;; -d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;; -f|--configfile) configfile="$2" ; shift 2 ;; -s|--passwdfile) CLO_PASSWDFILE="$2" ; shift 2 ;; @@ -261,6 +303,8 @@ eof # Generate and install Zebra config files. generate_config_file zebra-biblios-site.cfg.in \ "/etc/koha/sites/$name/zebra-biblios.cfg" + generate_config_file zebra-biblios-dom-site.cfg.in \ + "/etc/koha/sites/$name/zebra-biblios-dom.cfg" generate_config_file zebra-authorities-site.cfg.in \ "/etc/koha/sites/$name/zebra-authorities.cfg" generate_config_file zebra-authorities-dom-site.cfg.in \ diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index ab8aff5..d0f1388 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -26,7 +26,7 @@ /var/lib/koha/__KOHASITE__/biblios - /etc/koha/sites/__KOHASITE__/zebra-biblios.cfg + /etc/koha/sites/__KOHASITE__/zebra-biblios__BIBLIO_INDEXING__.cfg /etc/koha/zebradb/pqf.properties @@ -102,7 +102,7 @@ /var/lib/koha/__KOHASITE__/authorities - /etc/koha/sites/__KOHASITE__/zebra-authorities-dom.cfg + /etc/koha/sites/__KOHASITE__/zebra-authorities__AUTHORITY_INDEXING__.cfg /etc/koha/zebradb/pqf.properties @@ -176,7 +176,7 @@ /var/lib/koha/__KOHASITE__/biblios - /etc/koha/sites/__KOHASITE__/zebra-biblios.cfg + /etc/koha/sites/__KOHASITE__/zebra-biblios__BIBLIO_INDXING__.cfg /etc/koha/zebradb/pqf.properties -- 1.7.9.5