Bug 12836 - Add a script to regenerate Explain files from configs
Summary: Add a script to regenerate Explain files from configs
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Z39.50 / SRU / OpenSearch Servers (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Magnus Enger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 18240
  Show dependency treegraph
 
Reported: 2014-08-27 18:01 UTC by Tomás Cohen Arazi
Modified: 2017-10-15 13:08 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12836 - Add script to rewrite SRU Explain file (18.97 KB, patch)
2017-02-28 15:07 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 12836 - Add script to rewrite SRU Explain file (80.09 KB, patch)
2017-03-02 12:47 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2014-08-27 18:01:17 UTC
To reproduce:
- Have zebrasrv running with the default configuration
- Enable the public server
- Point your browser to http://localhost:9998 (or whatever port you have for the public server)
=> FAIL: you will notice

Caveat: (extracted from the zebrasrv docs)
"Unfortunately, the data found in the CQL-to-PQF text file must be added by hand-craft into the explain section of the YAZ Frontend Server configuration file to be able to provide a suitable explain record. Too bad, but this is all extreme new alpha stuff, and a lot of work has yet to be done .."
Comment 1 Magnus Enger 2017-02-27 12:29:06 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2017-02-27 12:31:31 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2017-02-27 12:36:07 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2017-02-27 13:22:13 UTC Comment hidden (obsolete)
Comment 5 Magnus Enger 2017-02-27 14:24:02 UTC
I think there also needs to be one explain document per instance (in a package install), since different instances can/will have SRU running on different ports. Working on the command line script to generate Explain now.
Comment 6 Magnus Enger 2017-02-28 15:07:01 UTC Comment hidden (obsolete)
Comment 7 Magnus Enger 2017-02-28 15:11:06 UTC Comment hidden (obsolete)
Comment 8 Marcel de Rooy 2017-02-28 15:35:22 UTC Comment hidden (obsolete)
Comment 9 Magnus Enger 2017-03-02 12:47:52 UTC
Created attachment 60791 [details] [review]
Bug 12836 - Add script to rewrite SRU Explain file

The standard SRU Explain files provided with Koha is static and out of
date. This patch does two things
- Add a script in misc/maintenance/generate_explain.pl that can generate
  a new Explain file, based on Koha's config files and an optional extra
  config file. See the POD in the script for more details.
- Replace the old Explain files provided with Koha with two new files,
  generated by the script described above and based on the standard
  Koha/Zebra config.

To test:
- Have a look at etc/zebradb/explain-authorities.xml and
  etc/zebradb/explain-biblios.xml and see if they make sense as example
  files. Check that the list of indexes corresponds to the indexes set
  up in etc/zebradb/pqf.properties.
- Run "perldoc misc/maintenance/generate_explain.pl" to see available
  options and a decription of the config file.
- Run generate_explain.pl with different options and settings in the
  config file, and check that the output Explain docs make sense.

This patch will not break anything. It is more about documentation.
The Explain file documents the SRU server, it does not configure it.
Comment 10 Magnus Enger 2017-03-02 12:50:41 UTC
My patch does not take into account the need for per-instance Explain docs. That will have to be a separate bug.
Comment 11 Katrin Fischer 2017-05-25 19:35:16 UTC
There is a lot of output running this from inside the koha-shell as 'perl misc/maintanence/generate_explain.pl'

Looking at /etc/koha/sites/kohadev/koha-conf.xml
Use of uninitialized value $publicserver in split at misc/maintenance/generate_explain.pl line 216.
Use of uninitialized value $host in concatenation (.) or string at misc/maintenance/generate_explain.pl line 217.
Use of uninitialized value $port in concatenation (.) or string at misc/maintenance/generate_explain.pl line 217.
SRU is listening on host  and port 
Use of uninitialized value $pqf_properties_file in concatenation (.) or string at misc/maintenance/generate_explain.pl line 221.
Looking at 
Use of uninitialized value $file_name in -e at /usr/share/perl5/File/Slurp.pm line 116.
Use of uninitialized value $file_name in sysopen at /usr/share/perl5/File/Slurp.pm line 193.
Use of uninitialized value $file_name in concatenation (.) or string at /usr/share/perl5/File/Slurp.pm line 194.
read_file '' - sysopen: No such file or directory at misc/maintenance/generate_explain.pl line 225.

Am I missing something?
Comment 12 Katrin Fischer 2017-10-15 13:08:25 UTC
I've still on luck testing this.

I think it might be missing -x 
-rwxrwxr-x 1 vagrant vagrant  4414 Dec 13  2016 fix_mysql_constraints.pl
-rw-r--r-- 1 vagrant vagrant  8796 Oct 15  2017 generate_explain.pl

I also get a lot of errors running it from the command line:

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ perl misc/maintenance/generate_explain.pl 
Use of uninitialized value $publicserver in split at misc/maintenance/generate_explain.pl line 216.
Use of uninitialized value $file_name in -e at /usr/share/perl5/File/Slurp.pm line 116.
Use of uninitialized value $file_name in sysopen at /usr/share/perl5/File/Slurp.pm line 193.
Use of uninitialized value $file_name in concatenation (.) or string at /usr/share/perl5/File/Slurp.pm line 194.
read_file '' - sysopen: No such file or directory at misc/maintenance/generate_explain.pl line 225.

Magnuse, can you please take a look and add some more instructions if necessary?