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

--- Comment #2 from David Nind <[email protected]> ---
Created attachment 191999
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191999&action=edit
Bug 40986: add examples to rebuild_elasticsearch.pl --man

This commit adds a bunch of example to rebuild_elasticsearch.pl --man, mostly
about passing custom sql via --where.

It also fixes a few trivial issues in rebuild_elasticsearch.pl and adds a note
to debian/scripts/koha-elasticsearch to point people to the extended docs

Test plan(s):

1: No examples in detailed help

* run: misc/search_tools/rebuild_elasticsearch.pl --man
* After OPTIONS (scroll down a bit with the down-arrow or hit space) the
section IMPLEMENTATION is shown.
* No EXAMPLES section

2: Ugly error message:

* run: misc/search_tools/rebuild_elasticsearch.pl --processes 2 --authid 123
* output: "Argument p|processes cannot be combined with bn|bnumber or ai|authid
at misc/search_tools/rebuild_elasticsearch.pl line 163."
* Notice "at misc/search_tools/rebuild_elasticsearch.pl line 163"

3: Warning:

* run: misc/search_tools/rebuild_elasticsearch.pl -v --biblios --where
'biblionumber = -1'
* output:
[9574] Checking state of biblios index
[9574] Indexing biblios
[9574] Committing final records...
Use of uninitialized value in string eq at
misc/search_tools/rebuild_elasticsearch.pl line 365.
[9574] Total 0 records indexed

* Notice the warning "Use of uninitialized value.."

4: Error when using --where without -b or -a

* run: misc/search_tools/rebuild_elasticsearch.pl -v --where 'biblionumber = 1'
* output:
misc/search_tools/rebuild_elasticsearch.pl -v --where 'biblionumber = 420'
...
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Unknown column 'biblionumber' in 'where clause' at
/kohadevbox/koha/Koha/MetadataRecord/Authority.pm line 239

* The script dies, because auth_header has not column biblionumber and we where
running --where on both tables.

5: No hint about reindex_elasticsearch in koha-elasticsearch

* run: debian/scripts/koha-elasticsearch --help
* There is no hint about reindex_elasticsearch.pl

Now apply the patch. No need to restart anything

1: examples are shown in detailed help

* run: misc/search_tools/rebuild_elasticsearch.pl --man
* after OPTIONS you will find a EXAMPLES section listing various use cases

2: Ugly error message is not ugly anymore

* run: misc/search_tools/rebuild_elasticsearch.pl --processes 2 --authid 123
* output: Argument p|processes cannot be combined with bn|bnumber or ai|authid
* no more "at blabla line ..."

3: Warning:

* run: misc/search_tools/rebuild_elasticsearch.pl -v --biblios --where
'biblionumber = -1'
* output:
[9574] Checking state of biblios index
[9574] Indexing biblios
[9574] Committing final records...
[9574] Total 0 records indexed

* Notice the warning "Use of uninitialized value.." is gone

4: Error when using --where without -b or -a

* run: misc/search_tools/rebuild_elasticsearch.pl -v --where 'biblionumber = 1'
* output: Argument w|where must be combined with either b|biblios or
a|authorities
* and the script aborts.

5: koha-elasticsearch mentions reindex_elasticsearch.pl

* run: debian/scripts/koha-elasticsearch --help
* There **is** a hint about reindex_elasticsearch.pl

Now apply the patch. No need to restart anything

Sponsored-by: HKS3
Sponsored-by: Koha DACH Hackfest
Signed-off-by: David Nind <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to