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> Signed-off-by: Thomas Klausner <domm@plix.at> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
45a9cd081d
commit
975f0c3508
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue