Bugzilla – Attachment 189822 Details for
Bug 36550
koha-elasticsearch commit default should be configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36550: allow defaults to be defined for koha-elasticsearch
Bug-36550-allow-defaults-to-be-defined-for-koha-el.patch (text/plain), 3.78 KB, created by
David Cook
on 2025-11-21 02:22:04 UTC
(
hide
)
Description:
Bug 36550: allow defaults to be defined for koha-elasticsearch
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-11-21 02:22:04 UTC
Size:
3.78 KB
patch
obsolete
>From 611247cb8bd675225ce39699c28d16e24229b6dd Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@kallisti.net.nz> >Date: Fri, 21 Nov 2025 14:35:54 +1300 >Subject: [PATCH] Bug 36550: allow defaults to be defined for > koha-elasticsearch > >koha-elasticsearch only allows the parameters to be specified on the >command line, otherwise it'll fall back to values hard-coded in the >script. This allows default parameters to be defined in >/etc/default/koha-common when installed with the Debian packages. > >It also copies the current defaults into the defaults file. > >Test plan, comprehensive: >1. You will need a package setup with elasticsearch, and some records. >2. Build a package (or copy the files modified in this patch over ones > you might already have installed) >3. Modify some ES_* values in /etc/default/koha-community to your > liking. 'ES_VERBOSE' might be a good one. >4. Do an elasticsearch reindex and observe that your parameter defaults > are respected. > >Test plan, simple: >1. With a git checkout: > * `sudo ln -s .../koha/debian/scripts/koha-functions.sh /usr/share/koha/bin/koha-functions.sh` > * `sudo ln -s .../koha/debian/koha-common.default /etc/default/koha-common` >2. Modify `.../koha/debian/scripts/koha-elasticsearch` around line 200 > so that it prints out the variables, and see that it properly respects > modifying the defaults and/or setting the command line arguments. > >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > debian/koha-common.default | 23 +++++++++++++++++++++++ > debian/scripts/koha-elasticsearch | 23 ++++++++++++++++------- > 2 files changed, 39 insertions(+), 7 deletions(-) > >diff --git a/debian/koha-common.default b/debian/koha-common.default >index 5c553e2b9f..bbe7524ab7 100644 >--- a/debian/koha-common.default >+++ b/debian/koha-common.default >@@ -34,4 +34,27 @@ INDEXER_TIMEOUT=5 > # > # INDEXER_PARAMS="" > >+# Elasticsearch default options. Specifying the command line options to >+# koha-elasticsearch will override these >+ >+# Should biblios be indexed by default? >+ES_INDEX_BIBLIOS="yes" >+# Should authorities be indexed by default? >+ES_INDEX_AUTHORITIES="yes" >+# How many records should be batched for committing to elasticsearch at one time. You >+# might want to decrease this if you're having issues with memory. >+# Equivalent to '--commit' >+ES_COMMIT_SIZE=5000 >+# Now many parallel processes to use for indexing. If you have CPU >+# cores to spare, this might be worth increasing. >+# Equivalent to '--processes' >+ES_NUMBER_OF_PROCESSES=1 >+# Should the output be verbose by default? >+# Equivalent to '--verbose' >+ES_VERBOSE="no" >+# A string that's supplied as a "where" query that can limit the records being idexed. >+# You probably don't want to use this by default expect in some sort of special case. >+# Equivalent to '--where' >+#ES_WHERE_QUERY_SQL="" >+ > ## End of general koha-common default options >diff --git a/debian/scripts/koha-elasticsearch b/debian/scripts/koha-elasticsearch >index e9a0a1ba10..5a9d6811a9 100755 >--- a/debian/scripts/koha-elasticsearch >+++ b/debian/scripts/koha-elasticsearch >@@ -131,16 +131,25 @@ run_rebuild_elasticsearch() > fi > } > >-# Default parameters >-biblios="yes" >-authorities="yes" >+# Default parameters from koha-common.default >+biblios=$ES_INDEX_BIBLIOS # the 'only' variants are skipped because they don't actually control >+authorities=$ES_INDEX_AUTHORITIES # anything and are just for setting stuff internally. >+commit_size=$ES_COMMIT_SIZE >+processes=$ES_NUMBER_OF_PROCESSES >+verbose=$ES_VERBOSE >+where=$ES_WHERE_QUERY_SQL >+ >+# Default parameters if all else fails >+: ${biblios:="yes"} >+: ${authorities:="yes"} >+: ${commit_size:=5000} >+: ${processes:=1} >+: ${verbose:="no"} >+: ${where:=""} >+ > biblios_only="no" > authorities_only="no" >-commit_size=5000 >-processes=1 >-verbose="no" > op="" >-where="" > > # Read parameters > while [ -n "$*" ]; do >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36550
:
189821
| 189822