<refsynopsisdiv>
<cmdsynopsis>
- <command>koha-rebuild-zebra</command> <arg><option>-u</option>|<option>--usmarc</option></arg> <arg><option>-f</option>|<option>--full</option></arg> <arg><option>-a</option>|<option>--authorities</option></arg> <arg><option>-b</option>|<option>--biblios</option></arg> <arg><option>-q</option>|<option>--quiet</option></arg> <arg><option>-v</option>|<option>--verbose</option></arg> <arg><option>...</option></arg> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
+ <command>koha-rebuild-zebra</command> <arg><option>-u</option>|<option>--usmarc</option></arg> <arg><option>--force</option></arg> <arg><option>-f</option>|<option>--full</option></arg> <arg><option>-a</option>|<option>--authorities</option></arg> <arg><option>-b</option>|<option>--biblios</option></arg> <arg><option>-q</option>|<option>--quiet</option></arg> <arg><option>-v</option>|<option>--verbose</option></arg> <arg><option>...</option></arg> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--force</option></term>
+ <listitem>
+ <para>Force incremental indexing when <option>USE_INDEXER_DAEMON=yes</option>.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>-f, --full</option></term>
<listitem>
- <para>Does a reindex of the whole collection.</para>
+ <para>Does a reindex of the whole collection. Will run even if <option>USE_INDEXER_DAEMON=yes</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
</refsect1>
<refsect1><title>Description</title>
- <para>Rebuild the Zebra database for Koha instances.</para>
+ <para>Rebuild the Zebra database for Koha instances. It will run incremental updates by default. It will be skipped if <option>USE_INDEXER_DAEMON=yes</option> in /etc/default/koha-common, unless <option>--force</option> or <option>--full</option> are used.</para>
</refsect1>
<refsect1><title>See also</title>
set -e
+# Read configuration variable file if it is present
+[ -r /etc/default/koha-common ] && . /etc/default/koha-common
+
# include helper functions
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
. "/usr/share/koha/bin/koha-functions.sh"
{
local instancename=$1; shift
- # TODO: This comment is here to remind us that we should make
- # rebuild_zebra.pl return error codes on failure
- if sudo -u "$instancename-koha" -H \
- env PERL5LIB=/usr/share/koha/lib \
- KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \
- /usr/share/koha/bin/migration_tools/rebuild_zebra.pl $@ ; then
- return 0
- else
- return 1
+ if [ "$USE_INDEXER_DAEMON" = "no" ] ||
+ [ "${full_reindex}" = "yes" ] ||
+ [ "${force}" = "yes" ] ; then
+
+ # TODO: This comment is here to remind us that we should make
+ # rebuild_zebra.pl return error codes on failure
+ if sudo -u "$instancename-koha" -H \
+ env PERL5LIB=/usr/share/koha/lib \
+ KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \
+ /usr/share/koha/bin/migration_tools/rebuild_zebra.pl $@ ; then
+ return 0
+ else
+ return 1
+ fi
fi
}
--authorities|-a Only run process for authorities.
--biblios|-b Only run process for biblios.
--full|-f Does a reindex of the whole collection.
+ --force Run incremental indexing even if USE_INDEXER_DAEMON="yes"
--quiet|-q Sometimes be a bit quieter for scripts/cronjobs.
--verbose|-v Be verbose.
--help|-h Print this help.
authorities_only="no"
biblios="yes"
authorities="yes"
+force="no"
+full_reindex="no"
+
# The '-q' option is intended to prevent the cronjob causing this to output
# help information if there are no instances defined.
quiet="no"
opt_xml=""
;;
-f|--full)
+ full_reindex="yes"
opt_idx="-r"
;;
+ --force)
+ force="yes"
+ ;;
-v|--verbose)
opt_verbose="-v"
;;