Browse Source

Bug 14302: Remove GRS1 specific code

Remove:
- BIB_INDEX_MODE and AUTH_INDEX_MODE env var
- bib_index_mode and auth_index_mode options from scripts
- Warnings from about page, just kept one if zebra_bib_index_mode or
zebra_auth_index_mode still exist in config and are set to grs1

Test plan:
- Install Koha from src
- Install Koha from pkg
- Read the code, carefully!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Rebased

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Jonathan Druart 5 years ago
committed by Nick Clemens
parent
commit
bee097b39b
  1. 12
      C4/Context.pm
  2. 60
      Makefile.PL
  3. 72
      about.pl
  4. 2
      debian/koha-common.postinst
  5. 4
      debian/koha.install
  6. 70
      debian/scripts/koha-create
  7. 2
      debian/templates/koha-conf-site.xml.in
  8. 10
      debian/templates/koha-sites.conf
  9. 2
      etc/koha-conf.xml
  10. 63
      koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
  11. 2
      misc/koha-install-log
  12. 5
      misc/migration_tools/rebuild_zebra.pl
  13. 10
      rewrite-config.PL
  14. 154
      t/db_dependent/Search.t
  15. 5
      t/db_dependent/XISBN.t
  16. 18
      t/db_dependent/zebra_config.pl

12
C4/Context.pm

@ -619,16 +619,8 @@ sub _new_Zconn {
$index_mode = $context->{'config'}->{'zebra_auth_index_mode'} // 'dom';
}
if ( $index_mode eq 'grs1' ) {
$elementSetName = 'F';
$syntax = ( $context->preference("marcflavour") eq 'UNIMARC' )
? 'unimarc'
: 'usmarc';
} else { # $index_mode eq 'dom'
$syntax = 'xml';
$elementSetName = 'marcxml';
}
$syntax = 'xml';
$elementSetName = 'marcxml';
my $host = $context->{'listen'}->{$server}->{'content'};
my $user = $context->{"serverinfo"}->{$server}->{"user"};

60
Makefile.PL

@ -91,8 +91,6 @@ Makefile.PL - Koha packager and installer
--zebra_sru_host Zebra SRU servername (e.g. localhost)
--zebra_sru_biblios_port Zebra SRU biblios port (e.g. 9998)
--zebra_sru_authorities_port Zebra SRU biblios port (e.g. 9999)
--auth_index_mode Authority index mode (grs1, dom)
--bib_index_mode Bibliographic index mode (grs1, dom)
--koha_user Koha Unix user (e.g. koha)
--koha_group Koha Unix group (e.g. koha)
--install_sru Install the SRU server (yes, no)
@ -470,8 +468,6 @@ my %config_defaults = (
'DB_TLS_CLIENT_KEY' => '/etc/mysql-ssl/client-key.pem',
'INSTALL_SRU' => 'yes',
'INSTALL_PAZPAR2' => 'no',
'AUTH_INDEX_MODE' => 'dom',
'BIB_INDEX_MODE' => 'dom',
'ZEBRA_MARC_FORMAT' => 'marc21',
'ZEBRA_LANGUAGE' => 'en',
'ZEBRA_TOKENIZER' => 'chr',
@ -517,8 +513,6 @@ my %valid_config_values = (
'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
'DB_USE_TLS' => {'yes', 'no'},
'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
'BIB_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'normarc' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
'ZEBRA_LANGUAGE' => { 'cs' => 1, 'en' => 1, 'es' => 1, 'fr' => 1, 'gr' => 1, 'nb' => 1, 'ru' => 1, 'uk' => 1 }, # FIXME should generate from contents of distribution
'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 },
@ -543,8 +537,6 @@ my $cli_zebra_pass = "";
my $cli_zebra_sru_host = "";
my $cli_zebra_sru_bib_port = "";
my $cli_zebra_sru_auth_port = "";
my $cli_koha_auth_index_mode = "";
my $cli_koha_bib_index_mode = "";
my $cli_koha_user = "";
my $cli_koha_group = "";
my $cli_koha_install_sru = "";
@ -572,8 +564,6 @@ my $results = GetOptions(
"zebra_sru_host=s" => \$cli_zebra_sru_host,
"zebra_sru_biblios_port=s" => \$cli_zebra_sru_bib_port,
"zebra_sru_authorities_port=s" => \$cli_zebra_sru_auth_port,
"auth_index_mode=s" => \$cli_koha_auth_index_mode,
"bib_index_mode=s" => \$cli_koha_bib_index_mode,
"koha_user=s" => \$cli_koha_user,
"koha_group=s" => \$cli_koha_group,
"install_sru=s" => \$cli_koha_install_sru,
@ -615,15 +605,11 @@ my $pl_files = {
push @{ $pl_files->{'rewrite-config.PL'} }, (
'blib/ZEBRA_CONF_DIR/etc/passwd',
'blib/ZEBRA_CONF_DIR/zebra-biblios.cfg',
'blib/ZEBRA_CONF_DIR/zebra-biblios-dom.cfg',
'blib/ZEBRA_CONF_DIR/zebra-authorities.cfg',
'blib/ZEBRA_CONF_DIR/zebra-authorities-dom.cfg',
'blib/ZEBRA_CONF_DIR/explain-authorities.xml',
'blib/ZEBRA_CONF_DIR/explain-biblios.xml',
'blib/ZEBRA_CONF_DIR/retrieval-info-auth-grs1.xml',
'blib/ZEBRA_CONF_DIR/retrieval-info-auth-dom.xml',
'blib/ZEBRA_CONF_DIR/retrieval-info-bib-grs1.xml',
'blib/ZEBRA_CONF_DIR/retrieval-info-bib-dom.xml',
);
push @{ $pl_files->{'rewrite-config.PL'} }, (
@ -637,19 +623,10 @@ if ($config{'INSTALL_PAZPAR2'} eq 'yes') {
'blib/PAZPAR2_CONF_DIR/pazpar2.xml'
);
}
$config{'ZEBRA_AUTH_CFG'} = $config{'AUTH_INDEX_MODE'} eq 'dom'
? 'zebra-authorities-dom.cfg'
: 'zebra-authorities.cfg';
$config{'ZEBRA_BIB_CFG'} = $config{'BIB_INDEX_MODE'} eq 'dom'
? 'zebra-biblios-dom.cfg'
: 'zebra-biblios.cfg';
$config{'AUTH_RETRIEVAL_CFG'} = $config{'AUTH_INDEX_MODE'} eq 'dom'
? 'retrieval-info-auth-dom.xml'
: 'retrieval-info-auth-grs1.xml';
$config{'BIB_RETRIEVAL_CFG'} = $config{'BIB_INDEX_MODE'} eq 'dom'
? 'retrieval-info-bib-dom.xml'
: 'retrieval-info-bib-grs1.xml';
$config{'ZEBRA_AUTH_CFG'} = 'zebra-authorities-dom.cfg';
$config{'ZEBRA_BIB_CFG'} = 'zebra-biblios-dom.cfg';
$config{'AUTH_RETRIEVAL_CFG'} = 'retrieval-info-auth-dom.xml';
$config{'BIB_RETRIEVAL_CFG'} = 'retrieval-info-bib-dom.xml';
if ($config{'INSTALL_MODE'} ne "dev") {
push @{ $pl_files->{'rewrite-config.PL'} }, (
@ -861,8 +838,6 @@ sub get_cli_values {
ZEBRA_SRU_HOST => $cli_zebra_sru_host,
ZEBRA_SRU_BIBLIOS_PORT => $cli_zebra_sru_bib_port,
ZEBRA_SRU_AUTHORITIES_PORT => $cli_zebra_sru_auth_port,
AUTH_INDEX_MODE => $cli_koha_auth_index_mode,
BIB_INDEX_MODE => $cli_koha_bib_index_mode,
KOHA_USER => $cli_koha_user,
KOHA_GROUP => $cli_koha_group,
INSTALL_SRU => $cli_koha_install_sru,
@ -1120,33 +1095,6 @@ Primary language for Zebra indexing);
$msg .= _add_valid_values_disp('ZEBRA_LANGUAGE', $valid_values);
$config{'ZEBRA_LANGUAGE'} = _get_value('ZEBRA_LANGUAGE', $msg, $defaults->{'ZEBRA_LANGUAGE'}, $valid_values, $install_log_values);
$msg = q(
Koha can use one of two different indexing modes
for the MARC bibliographic records:
dom - uses the DOM XML filter; offers improved
functionality.
grs1 - [DEPRECATED] uses the Zebra GRS-1 filter,
available for legacy support
Bibliographic indexing mode);
$msg .= _add_valid_values_disp('BIB_INDEX_MODE', $valid_values);
$config{'BIB_INDEX_MODE'} = _get_value('BIB_INDEX_MODE', $msg, $defaults->{'BIB_INDEX_MODE'}, $valid_values, $install_log_values);
$msg = q(
Koha can use one of two different indexing modes
for the MARC authorities records:
dom - uses the DOM XML filter; offers improved
functionality.
grs1 - [DEPRECATED] uses the Zebra GRS-1 filter,
available for legacy support
Authorities indexing mode);
$msg .= _add_valid_values_disp('AUTH_INDEX_MODE', $valid_values);
$config{'AUTH_INDEX_MODE'} = _get_value('AUTH_INDEX_MODE', $msg, $defaults->{'AUTH_INDEX_MODE'}, $valid_values, $install_log_values);
$msg = q(
Zebra has two methods to perform records tokenization
and characters normalization: CHR and ICU. ICU is

72
about.pl

@ -176,58 +176,16 @@ my @xml_config_warnings;
my $context = new C4::Context;
if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
push @xml_config_warnings, {
error => 'zebra_bib_index_mode_warn'
};
if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
push @xml_config_warnings, {
error => 'zebra_bib_mode_seems_grs1'
};
}
else {
push @xml_config_warnings, {
error => 'zebra_bib_mode_seems_dom'
};
}
} else {
push @xml_config_warnings, { error => 'zebra_bib_grs_warn' }
if C4::Context->config('zebra_bib_index_mode') eq 'grs1';
}
if ( (C4::Context->config('zebra_bib_index_mode') eq 'dom') &&
($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
push @xml_config_warnings, {
error => 'zebra_bib_index_mode_mismatch_warn'
};
}
if ( (C4::Context->config('zebra_bib_index_mode') eq 'grs1') &&
($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
push @xml_config_warnings, {
error => 'zebra_bib_index_mode_mismatch_warn'
};
if ( C4::Context->config('zebra_bib_index_mode')
and C4::Context->config('zebra_bib_index_mode') eq 'grs1' )
{
push @xml_config_warnings, { error => 'zebra_bib_index_mode_is_grs1' };
}
if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
push @xml_config_warnings, {
error => 'zebra_auth_index_mode_warn'
};
if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
push @xml_config_warnings, {
error => 'zebra_auth_mode_seems_grs1'
};
}
else {
push @xml_config_warnings, {
error => 'zebra_auth_mode_seems_dom'
};
}
} else {
push @xml_config_warnings, { error => 'zebra_auth_grs_warn' }
if C4::Context->config('zebra_auth_index_mode') eq 'grs1';
if ( C4::Context->config('zebra_auth_index_mode')
and C4::Context->config('zebra_auth_index_mode') eq 'grs1' )
{
push @xml_config_warnings, { error => 'zebra_auth_index_mode_is_grs1' };
}
if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
@ -236,12 +194,6 @@ if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'ser
};
}
if ( (C4::Context->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
push @xml_config_warnings, {
error => 'zebra_auth_index_mode_mismatch_warn'
};
}
if ( ! defined C4::Context->config('log4perl_conf') ) {
push @xml_config_warnings, {
error => 'log4perl_entry_missing'
@ -301,14 +253,6 @@ if ( C4::Context->preference( 'UseQueryParser' ) ) {
# Test Zebra facets configuration
if ( !defined C4::Context->config('use_zebra_facets') ) {
push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
} else {
if ( C4::Context->config('use_zebra_facets') &&
C4::Context->config('zebra_bib_index_mode') ) {
# use_zebra_facets works with DOM
push @xml_config_warnings, {
error => 'use_zebra_facets_needs_dom'
} if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
}
}
# ILL module checks

2
debian/koha-common.postinst

@ -136,7 +136,7 @@ fi
# that we're fixing them from is there, so we just run it every time. Maybe
# in many years time we can get rid of this, when no one will be running
# Koha < 3.20.
for zfile in $( find /etc/koha/sites -name zebra-authorities.cfg -or -name zebra-authorities-dom.cfg -or -name zebra-biblios.cfg -or -name zebra-biblios-dom.cfg ); do
for zfile in $( find /etc/koha/sites-name zebra-authorities-dom.cfg -or -name zebra-biblios-dom.cfg ); do
perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile
done

4
debian/koha.install

@ -1,7 +1,5 @@
debian/tmp/etc/apache2
debian/tmp/etc/koha/koha-httpd.conf
debian/tmp/var
debian/tmp/etc/koha/zebradb/zebra-biblios.cfg
debian/tmp/etc/koha/zebradb/zebra-authorities.cfg
debian/tmp/etc/koha/zebradb/zebra-authorities-dom.cfg
debian/tmp/etc/koha/zebradb/zebra-biblios-dom.cfg
debian/tmp/etc/koha/zebradb/zebra-biblios-dom.cfg

70
debian/scripts/koha-create

@ -102,8 +102,6 @@ generate_config_file() {
-e "s/__SRU_BIBLIOS_PORT__/$SRU_SERVER_PORT/g" \
-e "s/__START_SRU_PUBLICSERVER__/$START_SRU_PUBLICSERVER/g" \
-e "s/__END_SRU_PUBLICSERVER__/$END_SRU_PUBLICSERVER/g" \
-e "s/__BIBLIOS_INDEXING_MODE__/$BIBLIOS_INDEXING_MODE/g" \
-e "s/__AUTHORITIES_INDEXING_MODE__/$AUTHORITIES_INDEXING_MODE/g" \
-e "s/__ZEBRA_BIBLIOS_CFG__/$ZEBRA_BIBLIOS_CFG/g" \
-e "s/__ZEBRA_AUTHORITIES_CFG__/$ZEBRA_AUTHORITIES_CFG/g" \
-e "s/__START_BIBLIOS_RETRIEVAL_INFO__/`echo $START_BIBLIOS_RETRIEVAL_INFO`/g" \
@ -228,71 +226,41 @@ EOM
set_biblios_indexing_mode()
{
local indexing_mode=$1
local marc_format=$2
local marc_format=$1
case $indexing_mode in
"dom")
START_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
START_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
<xi:include href="\/etc\/koha\/$marc_format-retrieval-info-bib-dom.xml"\n
xmlns:xi="http:\/\/www.w3.org\/2001\/XInclude">\n
<xi:fallback>\n
<retrievalinfo>
EOF`
END_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
END_BIBLIOS_RETRIEVAL_INFO=`cat <<EOF
<\/retrievalinfo>\n
<\/xi:fallback>\n
<\/xi:include>
EOF`
BIBLIOS_INDEXING_MODE="dom"
ZEBRA_BIBLIOS_CFG="zebra-biblios-dom.cfg"
;;
"grs1")
START_BIBLIOS_RETRIEVAL_INFO=" <retrievalinfo>"
END_BIBLIOS_RETRIEVAL_INFO=" <\/retrievalinfo>"
BIBLIOS_INDEXING_MODE="grs1"
ZEBRA_BIBLIOS_CFG="zebra-biblios.cfg"
;;
*)
die "Error: '$indexing_mode' is not a valid indexing mode for bibliographic records."
;;
esac
ZEBRA_BIBLIOS_CFG="zebra-biblios-dom.cfg"
}
set_authorities_indexing_mode()
{
local indexing_mode=$1
local marc_format=$2
local marc_format=$1
case $indexing_mode in
"dom")
START_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
START_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
<xi:include href="\/etc\/koha\/$marc_format-retrieval-info-auth-dom.xml"\n
xmlns:xi="http:\/\/www.w3.org\/2001\/XInclude">\n
<xi:fallback>\n
<retrievalinfo>
EOF`
END_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
END_AUTHORITIES_RETRIEVAL_INFO=`cat <<EOF
<\/retrievalinfo>\n
<\/xi:fallback>\n
<\/xi:include>\n
EOF`
AUTHORITIES_INDEXING_MODE="dom"
ZEBRA_AUTHORITIES_CFG="zebra-authorities-dom.cfg"
;;
"grs1")
START_AUTHORITIES_RETRIEVAL_INFO=" <retrievalinfo>"
END_AUTHORITIES_RETRIEVAL_INFO=" <\/retrievalinfo>"
AUTHORITIES_INDEXING_MODE="grs1"
ZEBRA_AUTHORITIES_CFG="zebra-authorities.cfg"
;;
*)
die "Error: '$indexing_mode' is not a valid indexing mode for authority records."
;;
esac
ZEBRA_AUTHORITIES_CFG="zebra-authorities-dom.cfg"
}
@ -446,10 +414,6 @@ DEFAULT_SRU_SERVER_PORT="7090"
START_SRU_PUBLICSERVER="<!--"
END_SRU_PUBLICSERVER="-->"
# Indexing mode variables (default is DOM)
BIBLIOS_INDEXING_MODE="dom"
AUTHORITIES_INDEXING_MODE="dom"
START_BIBLIOS_RETRIEVAL_INFO=""
END_BIBLIOS_RETRIEVAL_INFO=""
START_AUTHORITIES_RETRIEVAL_INFO=""
@ -475,8 +439,6 @@ CLO_ZEBRA_MARC_FORMAT=""
CLO_ZEBRA_LANGUAGE=""
CLO_DEFAULTSQL=""
CLO_ADMINUSER=""
CLO_BIBLIOS_INDEXING_MODE=""
CLO_AUTHORITIES_INDEXING_MODE=""
CLO_MEMCACHED_SERVERS=""
CLO_MEMCACHED_PREFIX=""
CLO_UPLOAD_PATH=""
@ -503,10 +465,6 @@ while true ; do
CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
-l|--zebralang)
CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;;
--auth-idx)
CLO_AUTHORITIES_INDEXING_MODE="$2" ; shift 2 ;;
--biblio-idx)
CLO_BIBLIOS_INDEXING_MODE="$2" ; shift 2 ;;
-d|--defaultsql)
CLO_DEFAULTSQL="$2" ; shift 2 ;;
-f|--configfile)
@ -583,17 +541,13 @@ if [ "$CLO_BIBLIOS_INDEXING_MODE" != "" ]; then
BIBLIOS_INDEXING_MODE=$CLO_BIBLIOS_INDEXING_MODE
fi
set_biblios_indexing_mode $BIBLIOS_INDEXING_MODE $ZEBRA_MARC_FORMAT
set_biblios_indexing_mode $ZEBRA_MARC_FORMAT
if [ "$ENABLE_SRU" != "no" ]; then
enable_sru_server
fi
if [ "$CLO_AUTHORITIES_INDEXING_MODE" != "" ]; then
AUTHORITIES_INDEXING_MODE=$CLO_AUTHORITIES_INDEXING_MODE
fi
set_authorities_indexing_mode $AUTHORITIES_INDEXING_MODE $ZEBRA_MARC_FORMAT
set_authorities_indexing_mode $ZEBRA_MARC_FORMAT
[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
@ -754,12 +708,8 @@ eof
"/etc/koha/sites/$name/log4perl.conf"
# 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 \
"/etc/koha/sites/$name/zebra-authorities-dom.cfg"
generate_config_file zebra.passwd.in \

2
debian/templates/koha-conf-site.xml.in

@ -279,8 +279,6 @@ __END_SRU_PUBLICSERVER__
<install_log>/usr/share/koha/misc/koha-install-log</install_log>
<useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
<useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
<zebra_bib_index_mode>__BIBLIOS_INDEXING_MODE__</zebra_bib_index_mode>
<zebra_auth_index_mode>__AUTHORITIES_INDEXING_MODE__</zebra_auth_index_mode>
<zebra_lockdir>/var/lock/koha/__KOHASITE__</zebra_lockdir>
<use_zebra_facets>1</use_zebra_facets>
<queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>

10
debian/templates/koha-sites.conf

@ -32,16 +32,6 @@ ZEBRA_MARC_FORMAT="marc21"
# default: 'en'
ZEBRA_LANGUAGE="en"
# BIBLIOS_INDEXING_MODE: 'dom' | 'grs1'
# Indexing mode for bibliographic records
# default: 'dom'
BIBLIOS_INDEXING_MODE="dom"
# AUTHORITIES_INDEXING_MODE: 'dom' | 'grs1'
# Indexing mode for authority records
# default: 'dom'
AUTHORITIES_INDEXING_MODE="dom"
## Memcached global configuration variables
#
# USE_MEMCACHED: 'yes' | 'no'

2
etc/koha-conf.xml

@ -115,8 +115,6 @@ __PAZPAR2_TOGGLE_XML_POST__
<install_log>__MISC_DIR__/koha-install-log</install_log>
<useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
<useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
<zebra_bib_index_mode>__BIB_INDEX_MODE__</zebra_bib_index_mode>
<zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
<zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
<use_zebra_facets>1</use_zebra_facets>
<queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>

63
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

@ -307,70 +307,22 @@
<table>
<caption>XML configuration file</caption>
[% FOREACH config_entry IN xml_config_warnings %]
[% IF config_entry.error == 'zebra_bib_index_mode_warn' %]
[% IF config_entry.error == 'zebra_bib_index_mode_is_grs1' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_bib_index_mode&gt; entry is missing in your configuration file.
It should be set to 'dom' or 'grs1' (deprecated).
It will default to 'dom'.
</td>
</tr>
[% ELSIF config_entry.error == 'zebra_bib_mode_seems_grs1' %]
<tr>
<th scope="row"><b>Info</b></th>
<td>Your configuration file still seems to be set up for 'grs1'.</td>
</tr>
[% ELSIF config_entry.error == 'zebra_bib_mode_seems_dom' %]
<tr>
<th scope="row"><b>Info</b></th>
<td>Your configuration file seems to be set up for 'dom'.</td>
</tr>
[% ELSIF config_entry.error == 'zebra_auth_index_mode_warn' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_auth_index_mode&gt; entry is missing in your configuration file.
It should be set to 'dom' or 'grs1' (deprecated).
It will default to 'dom'.
</td>
</tr>
[% ELSIF config_entry.error == 'zebra_auth_mode_seems_grs1' %]
<tr>
<th scope="row"><b>Info</b></th>
<td>Your configuration file still seems to be set up for 'grs1'.</td>
</tr>
[% ELSIF config_entry.error == 'zebra_auth_mode_seems_dom' %]
<tr>
<th scope="row"><b>Info</b></th>
<td>Your configuration file seems to be set up for 'dom'.</td>
</tr>
[% ELSIF config_entry.error == 'zebra_bib_grs_warn' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_bib_index_mode&gt; entry is set to 'grs1'.
GRS-1 support is now deprecated and will be removed in future releases.
<td>The &lt;zebra_bib_index_mode&gt; entry set to 'grs1', which is no longer supported.
Please use DOM instead. To switch follow this page of wiki:
<a href="https://wiki.koha-community.org/wiki/Switching_to_dom_indexing">Switching to dom indexing</a>
</td>
</tr>
[% ELSIF config_entry.error == 'zebra_bib_index_mode_mismatch_warn' %]
[% ELSIF config_entry.error == 'zebra_auth_index_mode_is_grs1' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_bib_index_mode&gt; entry is set to 'dom', but your system still appears to be set up for 'grs1' indexing.</td>
</tr>
[% ELSIF config_entry.error == 'zebra_auth_grs_warn' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_auth_index_mode&gt; entry is set to 'grs1'.
GRS-1 support is now deprecated and will be removed in future releases.
<td>The &lt;zebra_auth_index_mode&gt; entry set to 'grs1', which is no longer supported.
Please use DOM instead. To switch follow this page of wiki:
<a href="https://wiki.koha-community.org/wiki/Switching_to_dom_indexing">Switching to dom indexing</a>
</td>
</tr>
[% ELSIF config_entry.error == 'zebra_auth_index_mode_mismatch_warn' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>The &lt;zebra_auth_index_mode&gt; entry is set to 'dom', but your system still appears to be set up for 'grs1' indexing.</td>
</tr>
[% ELSIF config_entry.error == 'queryparser_entry_missing' %]
<tr>
<th scope="row"><b>Warning</b></th>
@ -385,13 +337,6 @@
to legacy facet calculation.
</td>
</tr>
[% ELSIF config_entry.error == 'use_zebra_facets_needs_dom' %]
<tr>
<th scope="row"><b>Warning</b></th>
<td>You have set &lt;use_zebra_facets&gt; but the &lt;zebra_bib_index_mode&gt; is not set to 'dom'. Falling back
to legacy facet calculation.
</td>
</tr>
[% ELSIF config_entry.error == 'log4perl_entry_missing' %]
<tr>
<th scope="row"><b>Warning</b></th>

2
misc/koha-install-log

@ -60,8 +60,6 @@ INSTALL_BASE=__INSTALL_BASE__
INSTALL_ZEBRA=__INSTALL_ZEBRA__
INSTALL_SRU=__INSTALL_SRU__
INSTALL_PAZPAR2=__INSTALL_PAZPAR2__
BIB_INDEX_MODE=__BIB_INDEX_MODE__
AUTH_INDEX_MODE=__AUTH_INDEX_MODE__
ZEBRA_TOKENIZER=__ZEBRA_TOKENIZER__
RUN_DATABASE_TESTS=__RUN_DATABASE_TESTS__
PATH_TO_ZEBRA=__PATH_TO_ZEBRA__

5
misc/migration_tools/rebuild_zebra.pl

@ -169,8 +169,6 @@ my $biblioserverdir = C4::Context->zebraconfig('biblioserver')->{directory};
my $authorityserverdir = C4::Context->zebraconfig('authorityserver')->{directory};
my $kohadir = C4::Context->config('intranetdir');
my $bib_index_mode = C4::Context->config('zebra_bib_index_mode') // 'dom';
my $auth_index_mode = C4::Context->config('zebra_auth_index_mode') // 'dom';
my ($biblionumbertagfield,$biblionumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblio.biblionumber","");
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblioitems.biblioitemnumber","");
@ -281,8 +279,7 @@ if ($keep_export) {
print "parameter";
}
print "\n";
print "if you just want to rebuild zebra after changing the record.abs\n";
print "or another zebra config file\n";
print "if you just want to rebuild zebra after changing zebra config files\n";
} else {
unless ($use_tempdir) {
# if we're using a temporary directory

10
rewrite-config.PL

@ -131,10 +131,10 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
'__ZEBRA_TOKENIZER__' => 'chr',
'__ZEBRA_TOKENIZER_STMT__' => 'charmap word-phrase-utf.chr',
'__ZEBRA_PTOKENIZER_STMT__' => 'charmap word-phrase-utf.chr',
'__ZEBRA_AUTH_CFG__' => 'zebra-authorities.cfg',
'__ZEBRA_BIB_CFG__' => 'zebra-biblios.cfg',
'__AUTH_RETRIEVAL_CFG__' => 'retrieval-info-auth-grs1.xml',
'__BIB_RETRIEVAL_CFG__' => 'retrieval-info-bib-grs1.xml',
'__AUTH_RETRIEVAL_CFG__' => 'retrieval-info-auth-dom.xml',
'__BIB_RETRIEVAL_CFG__' => 'retrieval-info-bib-dom.xml',
'__ZEBRA_AUTH_CFG__' => 'zebra-authorities-dom.cfg',
'__ZEBRA_BIB_CFG__' => 'zebra-biblios-dom.cfg',
"__MERGE_SERVER_HOST__" => $myhost,
"__MERGE_SERVER_PORT__" => '11001',
"__PAZPAR2_HOST__" => $myhost,
@ -145,8 +145,6 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
"__INSTALL_PAZPAR2__" => 'no',
"__PAZPAR2_TOGGLE_XML_PRE__" => '<!--',
"__PAZPAR2_TOGGLE_XML_POST__" => '-->',
"__AUTH_INDEX_MODE__" => 'grs1',
"__BIB_INDEX_MODE__" => 'grs1',
"__RUN_DATABASE_TESTS__" => 'no',
"__PATH_TO_ZEBRA__" => "",
"__USE_MEMCACHED__" => 'yes',

154
t/db_dependent/Search.t

@ -27,7 +27,7 @@ require C4::Context;
# work around spurious wide character warnings
use open ':std', ':encoding(utf8)';
use Test::More tests => 4;
use Test::More tests => 2;
use Test::MockModule;
use Test::Warn;
@ -45,24 +45,24 @@ our $child;
our $datadir;
sub index_sample_records_and_launch_zebra {
my ($datadir, $indexing_mode, $marc_type) = @_;
my ($datadir, $marc_type) = @_;
my $sourcedir = dirname(__FILE__) . "/data";
unlink("$datadir/zebra.log");
if (-f "$sourcedir/${marc_type}/zebraexport/biblio/exported_records") {
my $zebra_bib_cfg = ($indexing_mode eq 'dom') ? 'zebra-biblios-dom.cfg' : 'zebra-biblios.cfg';
my $zebra_bib_cfg = 'zebra-biblios-dom.cfg';
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_bib_cfg -v none,fatal -g iso2709 -d biblios init");
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_bib_cfg -v none,fatal -g iso2709 -d biblios update $sourcedir/${marc_type}/zebraexport/biblio");
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_bib_cfg -v none,fatal -g iso2709 -d biblios commit");
}
# ... and add large bib records, if present
if (-f "$sourcedir/${marc_type}/zebraexport/large_biblio_${indexing_mode}/exported_records.xml") {
my $zebra_bib_cfg = ($indexing_mode eq 'dom') ? 'zebra-biblios-dom.cfg' : 'zebra-biblios.cfg';
my $zebra_bib_cfg = 'zebra-biblios-dom.cfg';
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_bib_cfg -v none,fatal -g marcxml -d biblios update $sourcedir/${marc_type}/zebraexport/large_biblio_${indexing_mode}");
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_bib_cfg -v none,fatal -g marcxml -d biblios commit");
}
if (-f "$sourcedir/${marc_type}/zebraexport/authority/exported_records") {
my $zebra_auth_cfg = ($indexing_mode eq 'dom') ? 'zebra-authorities-dom.cfg' : 'zebra-authorities.cfg';
my $zebra_auth_cfg = 'zebra-authorities-dom.cfg';
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_auth_cfg -v none,fatal -g iso2709 -d authorities init");
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_auth_cfg -v none,fatal -g iso2709 -d authorities update $sourcedir/${marc_type}/zebraexport/authority");
system("zebraidx -c $datadir/etc/koha/zebradb/$zebra_auth_cfg -v none,fatal -g iso2709 -d authorities commit");
@ -203,9 +203,8 @@ sub mock_GetMarcSubfieldStructure {
}
sub run_marc21_search_tests {
my $indexing_mode = shift;
$datadir = tempdir();
system(dirname(__FILE__) . "/zebra_config.pl $datadir marc21 $indexing_mode");
system(dirname(__FILE__) . "/zebra_config.pl $datadir marc21");
Koha::Caches->get_instance('config')->flush_all;
@ -213,11 +212,6 @@ sub run_marc21_search_tests {
my $context = new C4::Context("$datadir/etc/koha-conf.xml");
$context->set_context();
is($context->config('zebra_bib_index_mode'),$indexing_mode,
"zebra_bib_index_mode is properly set to '$indexing_mode' in the created koha-conf.xml file (BZ11499)");
is($context->config('zebra_auth_index_mode'),$indexing_mode,
"zebra_auth_index_mode is properly set to '$indexing_mode' in the created koha-conf.xml file (BZ11499)");
use_ok('C4::Search');
# set search syspreferences to a known starting point
@ -259,7 +253,7 @@ sub run_marc21_search_tests {
'VM' => { 'imageurl' => 'bridge/dvd.gif', 'summary' => '', 'itemtype' => 'VM', 'description' => 'Visual Materials' },
);
index_sample_records_and_launch_zebra($datadir, $indexing_mode, 'marc21');
index_sample_records_and_launch_zebra($datadir, 'marc21');
my ($biblionumber, $title);
my $record = MARC::Record->new;
@ -326,78 +320,40 @@ sub run_marc21_search_tests {
getRecords('au:Lessig', 'au:Lessig', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords title search for 'Australia' matched right number of records");
if ( $indexing_mode eq 'dom' ) {
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple relevance sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien'
, "Simple ascending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/
, "Simple descending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple ascending publication date sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies'
, "Simple descending publication date sorting in getRecords matches old behavior");
} elsif ( $indexing_mode eq 'grs1' ){
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Efectos del ambiente/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple relevance sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/la enfermedad laboral\^ies$/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[6])->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'World health statistics 2009^ien'
, "Simple ascending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[12])->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/la enfermedad laboral\^ies$/
, "Simple descending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'Manual de higiene industrial^ies' &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple ascending publication date sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Estado de salud/ &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'Manual de higiene industrial^ies'
, "Simple descending publication date sorting in getRecords matches old behavior");
}
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple relevance sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien'
, "Simple ascending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/
, "Simple descending author sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/
, "Simple ascending publication date sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef);
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' &&
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies'
, "Simple descending publication date sorting in getRecords matches old behavior");
( undef, $results_hashref, $facets_loop ) =
getRecords('books', 'books', [ 'relevance' ], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, undef, 1);
@ -544,12 +500,7 @@ if ( $indexing_mode eq 'dom' ) {
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results");
if ($indexing_mode eq 'grs1') {
is(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first");
} else {
local $TODO = "Query weighting does not behave exactly the same in DOM vs. GRS";
is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first");
}
is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first");
$QueryStemming = $QueryWeightFields = $QueryFuzzy = 0;
$QueryAutoTruncate = 1;
@ -881,9 +832,8 @@ if ( $indexing_mode eq 'dom' ) {
}
sub run_unimarc_search_tests {
my $indexing_mode = shift;
$datadir = tempdir();
system(dirname(__FILE__) . "/zebra_config.pl $datadir unimarc $indexing_mode");
system(dirname(__FILE__) . "/zebra_config.pl $datadir unimarc");
Koha::Caches->get_instance('config')->flush_all;
@ -901,7 +851,7 @@ sub run_unimarc_search_tests {
$UseQueryParser = 0;
$marcflavour = 'UNIMARC';
index_sample_records_and_launch_zebra($datadir, $indexing_mode, 'unimarc');
index_sample_records_and_launch_zebra($datadir, 'unimarc');
my ( $error, $marcresults, $total_hits ) = SimpleSearch("ti=Järnvägarnas efterfrågan och den svenska industrin", 0, 10);
is($total_hits, 1, 'UNIMARC title search');
@ -978,24 +928,14 @@ sub run_unimarc_search_tests {
cleanup();
}
subtest 'MARC21 + GRS-1' => sub {
plan tests => 110;
run_marc21_search_tests('grs1');
};
subtest 'MARC21 + DOM' => sub {
plan tests => 110;
run_marc21_search_tests('dom');
};
subtest 'UNIMARC + GRS-1' => sub {
plan tests => 14;
run_unimarc_search_tests('grs1');
plan tests => 108;
run_marc21_search_tests();
};
subtest 'UNIMARC + DOM' => sub {
plan tests => 14;
run_unimarc_search_tests('dom');
run_unimarc_search_tests();
};
# Make sure that following tests are not using our config settings

5
t/db_dependent/XISBN.t

@ -109,10 +109,7 @@ sub Mock_SimpleSearch {
}
$record->append_fields($biblionumber_field);
my $indexing_mode = C4::Context->config('zebra_bib_index_mode') // 'dom';
push @results, ( $indexing_mode eq 'dom' )
? $record->as_xml()
: $record->as_usmarc() ;
push @results, $record->as_xml();
return ( undef, \@results, 1 );
}

18
t/db_dependent/zebra_config.pl

@ -15,21 +15,11 @@ my $destination = $ARGV[0];
my $marc_type = $ARGV[1] || 'marc21';
my $indexing_mode = $ARGV[2] || 'dom';
$ENV{__BIB_INDEX_MODE__} = $indexing_mode;
$ENV{__AUTH_INDEX_MODE__} = $indexing_mode;
$ENV{__ZEBRA_MARC_FORMAT__} = $marc_type;
if ($indexing_mode eq 'dom') {
$ENV{__ZEBRA_BIB_CFG__} = 'zebra-biblios-dom.cfg';
$ENV{__BIB_RETRIEVAL_CFG__} = 'retrieval-info-bib-dom.xml';
$ENV{__ZEBRA_AUTH_CFG__} = 'zebra-authorities-dom.cfg';
$ENV{__AUTH_RETRIEVAL_CFG__} = 'retrieval-info-auth-dom.xml';
} else {
$ENV{__ZEBRA_BIB_CFG__} = 'zebra-biblios.cfg';
$ENV{__BIB_RETRIEVAL_CFG__} = 'retrieval-info-bib-grs1.xml';
$ENV{__ZEBRA_AUTH_CFG__} = 'zebra-authorities.cfg';
$ENV{__AUTH_RETRIEVAL_CFG__} = 'retrieval-info-auth-grs1.xml';
}
$ENV{__ZEBRA_BIB_CFG__} = 'zebra-biblios-dom.cfg';
$ENV{__BIB_RETRIEVAL_CFG__} = 'retrieval-info-bib-dom.xml';
$ENV{__ZEBRA_AUTH_CFG__} = 'zebra-authorities-dom.cfg';
$ENV{__AUTH_RETRIEVAL_CFG__} = 'retrieval-info-auth-dom.xml';
make_path("$destination/var/lock/zebradb");
make_path("$destination/var/lock/zebradb/biblios");

Loading…
Cancel
Save