Bug 40017 - Z39.50 search: Allow leader and specific control field positions in Additional fields
Summary: Z39.50 search: Allow leader and specific control field positions in Additiona...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-28 13:45 UTC by Marcel de Rooy
Modified: 2025-06-04 11:20 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement to the AdditionalFieldsInZ3950ResultSearch and AdditionalFieldsInZ3950ResultAuthSearch system preferences improves what you can show for the additional fields in the Z39.50 search results: [1] the complete leader with 000 [2] the complete control field, for example 008 [3] specific positions in the leader or control fields, for example 000p1, 008p2, etc. [4] a range from the leader or control field, for example 000p6-7, 008p35-37, etc.
Version(s) released in:
Circulation function:


Attachments
Bug 40017: Add leader and control field positions to Z3950 search results (7.15 KB, patch)
2025-05-28 14:05 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 40017: (follow-up) More rigorous checking (1.69 KB, patch)
2025-06-02 09:07 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 40017: Add leader and control field positions to Z3950 search results (7.15 KB, patch)
2025-06-04 11:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 40017: (follow-up) More rigorous checking (1.69 KB, patch)
2025-06-04 11:03 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2025-05-28 13:45:58 UTC
Would be nice to include things like
    000p6-7 for position 6 and 7 of leader (field '000')
    008p35-37 (pos 35-57, language) of 008
in the prefs for additional fields in Z39.50 search.

AdditionalFieldsInZ3950ResultSearch 	
AdditionalFieldsInZ3950ResultAuthSearch
Comment 1 Marcel de Rooy 2025-05-28 14:05:39 UTC
Created attachment 182821 [details] [review]
Bug 40017: Add leader and control field positions to Z3950 search results

Test plan:
Run t/Breeding.t
Set AdditionalFieldsInZ3950ResultSearch to 000p6, 008, 040$b
Do some searches and check the Additional fields column of results.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 David Nind 2025-06-01 21:41:16 UTC
After applying the patch, Z39.50/SRU searches return results only for the LIBRARY OF CONGRESS SRU search target. Any other search target returns a 500 error.

Testing notes (using KTD, MARC21):

1. Before applying the patch:
   - Set AdditionalFieldsInZ3950ResultSearch = 000p6, 008p35-37, 040$b
   - Go to Cataloguing > New from Z39.50/SRU > Books, Booklets, Workbooks
   - In the title enter: dita
   - Note that in the additional fields column, some of the returned records have additional information - such as the full 008 or the value of 040$b (none of the search results had any 001 values)

2. After applying the patch, restart everything (restart_all) and clear your browser cache.

3. If you repeat step 1, I sometimes got results. But most often I got an Error 500 page. (Before the patch, I didn't get any). With the sample targets in KTD:
   - I was only ever able to get results when using LIBRARY OF CONGRESS SRU
   - If LIBRARY OF CONGRESS or NATIONAL LIBRARY OF FRANCE were selected, I always got a 500 error
   - Before the patch: any combination of search targets returned results

4. The /var/log/koha/kohadev/plack-intranet-error.log only contains warnings: lots of [WARN] Use of uninitialized value ...

5. The tests pass: prove t/Breeding.t
Comment 3 Marcel de Rooy 2025-06-02 08:37:41 UTC
(In reply to David Nind from comment #2)
> After applying the patch, Z39.50/SRU searches return results only for the
> LIBRARY OF CONGRESS SRU search target. Any other search target returns a 500
> error.

Thats weird. I cant reproduce with the LOC server. The National Library of France times out with me. (What were your search fields and used terms.)

For 500 errors, please check plack-error.log and extract the error description and the offending line from C4/Breeding from the trace.

> 4. The /var/log/koha/kohadev/plack-intranet-error.log only contains
> warnings: lots of [WARN] Use of uninitialized value ...

Please copy distinct warnings when these refer to the Breeding module.

Thanks.
Comment 4 Marcel de Rooy 2025-06-02 08:44:34 UTC
(In reply to Marcel de Rooy from comment #3)
> Thats weird. I cant reproduce with the LOC server. The National Library of
> France times out with me. (What were your search fields and used terms.)

Wait. I can reproduce now while looking more closely to your test plan. An seemingly important difference is starting from Books, Booklets, .. Looking further.
Comment 5 Marcel de Rooy 2025-06-02 09:07:19 UTC
Created attachment 182902 [details] [review]
Bug 40017: (follow-up) More rigorous checking

Adding a few checks to resolve the errors David found while
testing.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2025-06-02 09:08:47 UTC
David, the follow-up should take care of the errors you catched. Thanks. I got now results with the same pref value, for title=dita and targets LOC and France library.
Comment 7 David Nind 2025-06-04 11:03:08 UTC
Created attachment 182939 [details] [review]
Bug 40017: Add leader and control field positions to Z3950 search results

Test plan:
Run t/Breeding.t
Set AdditionalFieldsInZ3950ResultSearch to 000p6, 008, 040$b
Do some searches and check the Additional fields column of results.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-06-04 11:03:11 UTC
Created attachment 182940 [details] [review]
Bug 40017: (follow-up) More rigorous checking

Adding a few checks to resolve the errors David found while
testing.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-06-04 11:11:15 UTC
(In reply to Marcel de Rooy from comment #6)
> David, the follow-up should take care of the errors you catched. Thanks. I
> got now results with the same pref value, for title=dita and targets LOC and
> France library.

Thanks Marcel!
Comment 10 Marcel de Rooy 2025-06-04 11:20:01 UTC
(In reply to David Nind from comment #9)
> (In reply to Marcel de Rooy from comment #6)
> > David, the follow-up should take care of the errors you catched. Thanks. I
> > got now results with the same pref value, for title=dita and targets LOC and
> > France library.
> 
> Thanks Marcel!

U+1F44D