https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22263

--- Comment #2 from Martin Renvoize (ashimema) 
<[email protected]> ---
This patch adds misc/maintenance/recalculate_cn_sort.pl.

Why a new script rather than touch_all_items.pl: touch_all_items.pl does
recalculate cn_sort (it marks itemcallnumber and cn_source dirty so that
Koha::Item->store recomputes the key), but it calls store with no
arguments. On a large catalogue that means one cataloguing log entry
(if CataloguingLog is on), one holds queue job (if RealTimeHoldsQueue is
on) and, with Elasticsearch, one update_elastic_index job per item, even
for items whose key does not change. This script only writes items whose
key changes, passes log_action => 0, skip_record_index and
skip_holds_queue, and queues the changed biblios for reindexing once at
the end (--skip-indexing leaves that to rebuild_elasticsearch.pl).

It can be limited with --cn_source (NULL for items with no source, which
use DefaultClassificationSource exactly as at save time) and --where, has
a --dry-run mode, and reports call numbers that produce an empty cn_sort.
That can happen when a filing rule such as LCC cannot parse a call
number, for example a Dewey-style "123.4 ABC" with the LCC rule.

Background: Koha::Item->store only recomputes cn_sort for an existing
item when itemcallnumber or cn_source changes (bug 23463). Changing a
classification source or its filing rule therefore never reaches existing
items, and saving an item or running batchRebuildItemsTables.pl does not
fix that either.

Related: bug 41932 (zero-padding in the Generic rule) will also leave
existing items with old keys until they are recalculated, so this script
should help there too.

Tested in KTD: with Elasticsearch enabled, three changed biblios produced
a single update_elastic_index job and no action_logs rows. Not tested
against a large catalogue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to