Bug 18909: Enable the maximum zebra records size to be specified per instance

The default for Zebra is to not return results where the record size is
greater than 1045 KB ( 1 MB ). Some libraries need to increase this
ceiling, but it may come at a cost with z39.50 compatibility with other
services. For that reason, we should make this setting configurable on a
per-instance basis.

Test plan for kohadevbox:
1) Apply this patch
2) Run:
   $ reset_all
3) Restart Zebra:
   $ sudo koha-zebra --restart kohadev
4) Check how zebrasrv was called:
   $ ps waux | grep zebrasrv
=> SUCCESS: Looks like
 ... /usr/bin/zebrasrv -v none,fatal,warn -k 1024
5) Edit /etc/koha/sites/kohadev/koha-conf.xml, add:
   <zebra_max_record_size>2048</zebra_max_record_size>
6) Repeat (3) and (4)
=> SUCCESS: Looks like
 ... /usr/bin/zebrasrv -v none,fatal,warn -k 2048
7) Sign off :-D

General test plan:
1) Apply this patch
2) Build a Debian package
3) Specify a zebra_max_record_size of 2048 in your koha_conf.xml
4) Restart zebra
5) Index a record greater than 1 MB but smaller than 2 MB
6) Note that it is searchable!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8c0c6be748)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 35fc9c1003)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2018-03-06 13:29:22 -05:00 committed by Lucas Gass
parent 9880c7d852
commit 2660cc8f0b
3 changed files with 14 additions and 0 deletions

View File

@ -254,6 +254,17 @@ get_loglevels()
fi
}
get_max_record_size()
{
local instancename=$1
local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_max_record_size' /etc/koha/sites/$instancename/koha-conf.xml)
if [ "$retval" != "" ]; then
echo "$retval"
else
echo "1024"
fi
}
get_tmpdir()
{
if [ "$TMPDIR" != "" ]; then

View File

@ -61,6 +61,7 @@ start_zebra()
# get zebra log levels from koha-conf.xml
local loglevels=$(get_loglevels ${name})
local max_record_size=$(get_max_record_size ${name})
if ! is_zebra_running $name; then
@ -76,6 +77,7 @@ start_zebra()
--user=${name}-koha.${name}-koha"
ZEBRA_PARAMS="-v $loglevels \
-k $max_record_size \
-f /etc/koha/sites/${name}/koha-conf.xml"
[ "$verbose" != "no" ] && \

View File

@ -283,6 +283,7 @@ __END_SRU_PUBLICSERVER__
<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>
<zebra_max_record_size>1024</zebra_max_record_size>
<queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>
<log4perl_conf>__KOHA_CONF_DIR__/log4perl.conf</log4perl_conf>
<!-- Uncomment/edit next setting if you want to adjust zebra log levels.