Bug 32695 - Search string for various 7xx linking fields is incorrectly formed
Summary: Search string for various 7xx linking fields is incorrectly formed
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 20:33 UTC by Nick Clemens (kidclamp)
Modified: 2024-04-26 06:53 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the search links for the MARC21 linking fields 775, 780, 785, 787 to search for $a and $t in separate indexes instead of searching for both in the title index.
Version(s) released in:
24.05.00


Attachments
Bug 32695: Use title (subfield t) only for 'Other editions' search links (5.27 KB, patch)
2023-05-26 19:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32695: Use title (subfield t) only for 'Other editions' search links (2.77 KB, patch)
2023-05-31 11:23 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32695: Use title (subfield t) only for 'Other editions' search links (2.82 KB, patch)
2023-05-31 14:59 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 32695: Use title (subfield t) only for 'Other editions' search links (2.82 KB, patch)
2023-06-09 11:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32695: Fix search strings for 775, 780, 785 and 787 (25.13 KB, patch)
2023-06-09 11:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32695: Use title (subfield t) only for 'Other editions' search links (2.87 KB, patch)
2024-01-19 07:41 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 32695: Fix search strings for 775, 780, 785 and 787 (25.18 KB, patch)
2024-01-19 07:41 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 32695: Fix search strings for 775, 780, 785 and 787 (25.41 KB, patch)
2024-04-18 21:17 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Test marc record (5.86 KB, application/xml)
2024-04-18 21:18 UTC, Nick Clemens (kidclamp)
Details
Bug 32695: Fix search strings for 775, 780, 785 and 787 (25.45 KB, patch)
2024-04-20 12:41 UTC, David Nind
Details | Diff | Splinter Review
Bug 32695: Fix search strings for 775, 780, 785 and 787 (25.52 KB, patch)
2024-04-23 10:09 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-01-20 20:33:54 UTC
We format the search as a title phrase 77$a + 77$t like so:

http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=ti,phr:AAAAAAAAAAAA%20%20TTTTTTTTTTTTTTtt

Looking at the documentation, field A is 'Main entry heading' and usually the author:

https://www.oclc.org/bibformats/en/7xx/775.html
https://www.oclc.org/bibformats/en/7xx/76x-78x.html#subfielda

So we likely need to form a title and author search instead
Comment 1 Nick Clemens (kidclamp) 2023-05-26 19:08:41 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2023-05-29 15:57:40 UTC
Hi Nick, please check the patch, it contains files that don't belong in there:

 installer/data/mysql/atomicupdate/bug_33117.pl            | 2 +-
 .../prog/en/modules/admin/preferences/circulation.pref    | 8 ++++----
 .../prog/en/xslt/MARC21slim2intranetDetail.xsl            | 2 +-
 .../opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 2 +-
 members/member.pl                                         | 2 +-

Also because of those the patch currently doesn't apply.
Comment 3 Nick Clemens (kidclamp) 2023-05-31 11:23:46 UTC Comment hidden (obsolete)
Comment 4 Sam Lau 2023-05-31 14:59:33 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2023-06-09 10:44:56 UTC
We have a better solution already implemented for one of other 7xx where we do a combined search with ti and au. I'll try to provide a patch.
Comment 6 Katrin Fischer 2023-06-09 11:27:20 UTC
Created attachment 152239 [details] [review]
Bug 32695: Use title (subfield t) only for 'Other editions' search links

Currently the code does a title phrase search, but combines the title field
with the Main Entry (author) field.

This patch simply limits the search to the title to ensure links work

To test:
1 - Ensure systme preference 'UseControlNumber' is set to don't
2 - Edit Default MARC framework in administration->Marc frameworks
3 - Make 775 subfields a & t visible in editor
4 - Edit a record to add a field 775 with subfields a & t that match another title/author in your system
5 - Save the record and view the details page
6 - Click the other editions link - no results
7 - Apply patch, restart_all
8 - Reload details and confirm the link works

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 7 Katrin Fischer 2023-06-09 11:27:23 UTC
Created attachment 152240 [details] [review]
Bug 32695: Fix search strings for 775, 780, 785 and 787

In the past due to some misunderstanding of the MARC standard
we built the search links for these fields using $a and $t with
the title index. But we actually need to search $t as title
and $a as author.
This patch fixes the templates for the MARC 7xx fields:
* 775
* 780
* 785
* 787

To test:
* Ensure systme preference 'UseControlNumber' is set to don't
* Create a record with the linking fields above
* Look at the OPAC and staff interface detail views
* Verify the content of your fields shows and the links combine a+t as a title search
* Apply patch
* Verify you have nicely formatted links now

Example:
775 _ _ ‡asomeone‡ttitle775
780 0 2 ‡asomeone‡ttitle780
785 0 2 ‡asomeone‡ttitle785
787 _ _ ‡ilabel:‡ttitle787‡asomeone
Comment 8 Janusz Kaczmarek 2023-09-12 13:10:40 UTC
Katrin,

just a doubt: is the commit:

Bug 32695: Use title (subfield t) only for 'Other editions' search links

really needed here in this patch?  In your second commit you are cancelling the creation of the variable f775, so the change "a_t -> t" disappears completely...
Comment 9 Janusz Kaczmarek 2023-09-12 13:18:54 UTC
Yet another remark - in MARC21slim2intranetDetail.xsl, after the patch being applied, in the line 1934 (... when test="$UseControlNumber = '1'...) a variable $f787 is being used, but is now not defined.
Comment 10 Biblibre Sandboxes 2024-01-19 07:41:39 UTC
Created attachment 161167 [details] [review]
Bug 32695: Use title (subfield t) only for 'Other editions' search links

Currently the code does a title phrase search, but combines the title field
with the Main Entry (author) field.

This patch simply limits the search to the title to ensure links work

To test:
1 - Ensure systme preference 'UseControlNumber' is set to don't
2 - Edit Default MARC framework in administration->Marc frameworks
3 - Make 775 subfields a & t visible in editor
4 - Edit a record to add a field 775 with subfields a & t that match another title/author in your system
5 - Save the record and view the details page
6 - Click the other editions link - no results
7 - Apply patch, restart_all
8 - Reload details and confirm the link works

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de>
Comment 11 Biblibre Sandboxes 2024-01-19 07:41:42 UTC
Created attachment 161168 [details] [review]
Bug 32695: Fix search strings for 775, 780, 785 and 787

In the past due to some misunderstanding of the MARC standard
we built the search links for these fields using $a and $t with
the title index. But we actually need to search $t as title
and $a as author.
This patch fixes the templates for the MARC 7xx fields:
* 775
* 780
* 785
* 787

To test:
* Ensure systme preference 'UseControlNumber' is set to don't
* Create a record with the linking fields above
* Look at the OPAC and staff interface detail views
* Verify the content of your fields shows and the links combine a+t as a title search
* Apply patch
* Verify you have nicely formatted links now

Example:
775 _ _ ‡asomeone‡ttitle775
780 0 2 ‡asomeone‡ttitle780
785 0 2 ‡asomeone‡ttitle785
787 _ _ ‡ilabel:‡ttitle787‡asomeone

Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de>
Comment 12 Sabrina Kiehl 2024-01-19 07:46:56 UTC
Hi,
For MARC 787 the search string was already formed as intended (ti,phr:("title") AND au:("creator")) before applying the patch.
After applying the patch the search string is a combined with subfield t in ti,phr index and subfield a in au index. If subfield a is empty the search string is formed :
ti,phr:("title")

If subfield t is empty the search string is formed:
ti,phr:("") AND au:("creator")
Which seems okay to me, because I can't think of a cataloguing situation in which subfield t could be empty and only subfield a is used. I just want to mention it.
Comment 13 Marcel de Rooy 2024-01-19 10:50:55 UTC
Please provide feedback first on comment8 and comment9.
Comment 14 Nick Clemens (kidclamp) 2024-04-18 21:17:04 UTC
Created attachment 165147 [details] [review]
Bug 32695: Fix search strings for 775, 780, 785 and 787

In the past due to some misunderstanding of the MARC standard
we built the search links for these fields using $a and $t with
the title index. But we actually need to search $t as title
and $a as author.
This patch fixes the templates for the MARC 7xx fields:
* 775
* 780
* 785
* 787

To test:
* Ensure systme preference 'UseControlNumber' is set to don't
* Create a record with the linking fields above
* Look at the OPAC and staff interface detail views
* Verify the content of your fields shows and the links combine a+t as a title search
* Apply patch
* Verify you have nicely formatted links now

Example:
775 _ _ ‡asomeone‡ttitle775
780 0 2 ‡asomeone‡ttitle780
785 0 2 ‡asomeone‡ttitle785
787 _ _ ‡ilabel:‡ttitle787‡asomeone

Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de>
Comment 15 Nick Clemens (kidclamp) 2024-04-18 21:18:18 UTC
Created attachment 165148 [details]
Test marc record

Just a marc record with fields with both or either tag to see how all the links form,
Comment 16 Nick Clemens (kidclamp) 2024-04-18 21:18:37 UTC
(In reply to Marcel de Rooy from comment #13)
> Please provide feedback first on comment8 and comment9.

Squashed, addressed, and added a test record
Comment 17 David Nind 2024-04-20 12:41:59 UTC
Created attachment 165234 [details] [review]
Bug 32695: Fix search strings for 775, 780, 785 and 787

In the past due to some misunderstanding of the MARC standard
we built the search links for these fields using $a and $t with
the title index. But we actually need to search $t as title
and $a as author.
This patch fixes the templates for the MARC 7xx fields:
* 775
* 780
* 785
* 787

To test:
* Ensure systme preference 'UseControlNumber' is set to don't
* Create a record with the linking fields above
* Look at the OPAC and staff interface detail views
* Verify the content of your fields shows and the links combine a+t as a title search
* Apply patch
* Verify you have nicely formatted links now

Example:
775 _ _ ‡asomeone‡ttitle775
780 0 2 ‡asomeone‡ttitle780
785 0 2 ‡asomeone‡ttitle785
787 _ _ ‡ilabel:‡ttitle787‡asomeone

Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de>
Signed-off-by: David Nind <david@davidnind.com>
Comment 18 David Nind 2024-04-20 12:52:23 UTC
Testing notes (using KTD):

1. Used the sample record.

2. For the Audio Cassettes, CDs (SR) framework, needed to edit the framework and make:  
   . the $a and $t subfields visible in the editor for the 775, 780, 785, and 787 tags;
   . the $i subfield visible in the editor for 787

3. See below for the before and after labels and links:
   . Now seem to be correct
   . For 787 - $i displayed correctly, no change to the actual query

Label and links before:

Other editions: someone title775  (link = search.pl?q=ti,phr:someone%20title775)
Supersedes: someone title780 (link = search.pl?q=ti,phr:someone%20title780)
Superseded by: someone title785 (link = search.pl?q=ti,phr:someone%20title785)
Other related works: label:: someone title787 (link = search.pl?q=ti%2Cphr%3A(%22title787%22)%20AND%20au%3A(%22someone%22))

Label and links after:

Other editions: someone title775 (catalogue/search.pl?q=ti%2Cphr%3A(%22title775%22)%20AND%20au%3A(%22someone%22))
Supersedes: someone title780 (catalogue/search.pl?q=ti%2Cphr%3A(%22title780%22)%20AND%20au%3A(%22someone%22))
Superseded by: someone title785 (search.pl?q=ti%2Cphr%3A(%22title785%22)%20AND%20au%3A(%22someone%22))
Other related works: label: someone title787 (search.pl?q=ti%2Cphr%3A(%22title787%22)%20AND%20au%3A(%22someone%22))
Comment 19 Martin Renvoize 2024-04-23 10:09:09 UTC
Created attachment 165365 [details] [review]
Bug 32695: Fix search strings for 775, 780, 785 and 787

In the past due to some misunderstanding of the MARC standard
we built the search links for these fields using $a and $t with
the title index. But we actually need to search $t as title
and $a as author.
This patch fixes the templates for the MARC 7xx fields:
* 775
* 780
* 785
* 787

To test:
* Ensure systme preference 'UseControlNumber' is set to don't
* Create a record with the linking fields above
* Look at the OPAC and staff interface detail views
* Verify the content of your fields shows and the links combine a+t as a title search
* Apply patch
* Verify you have nicely formatted links now

Example:
775 _ _ ‡asomeone‡ttitle775
780 0 2 ‡asomeone‡ttitle780
785 0 2 ‡asomeone‡ttitle785
787 _ _ ‡ilabel:‡ttitle787‡asomeone

Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 20 Martin Renvoize 2024-04-23 10:09:36 UTC
All appears to work as desired and issues worked out.

Passing QA
Comment 21 Katrin Fischer 2024-04-26 06:53:35 UTC
Pushed for 24.05!

Well done everyone, thank you!