Bug 39287 - Improve "Show volume" search with a more specialized search index
Summary: Improve "Show volume" search with a more specialized search index
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Jan Kissig
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-10 12:55 UTC by Katrin Fischer
Modified: 2025-12-12 13:26 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39287: Improve "Show volume" search with a more specialized search index (9.46 KB, patch)
2025-05-23 12:24 UTC, Jan Kissig
Details | Diff | Splinter Review
Record with volumes, predeccessor and successor (5.10 KB, application/xml)
2025-05-23 12:27 UTC, Jan Kissig
Details
Bug 39287: Improve "Show volume" search with a more specialized search index (9.41 KB, patch)
2025-10-08 15:12 UTC, Anke Bruns
Details | Diff | Splinter Review
Test plan part 1: Zebra: 0) start instance with searchengine set to Zebra a) set system preference UseControlNumber to Use b) import bug_39287.xml from the attachements f.e. via More -> Cataloging -> Stage records for import Format is MARCXML c) After (2.17 KB, patch)
2025-10-08 15:24 UTC, Anke Bruns
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2025-03-10 12:55:22 UTC
Currently the rcn index used to search for volumes contains all $w subfields from 7xx and 8xx linking fields. In some cases this is too broad, even tho we are additionally limiting to monographs.

Example:
Search volumes will also find
- records with a 775$w - other edition
- records with a matching 780/785$w - preceeding or succeeding
...

A specific index for searching volumes (rcn-volumes) should contain:

- 773$w (we still need to limit to monographic, because these could also be analytcal links)
- 800$w
- 810$w
- 811$w
- 830$w

Once the index is defined we can update the XSLT and the method for determining if the "Show volumes" link should be shown to use it and have a correct result list.
Comment 1 Jan Kissig 2025-05-23 12:24:36 UTC
Created attachment 182765 [details] [review]
Bug 39287: Improve "Show volume" search with a more specialized search index

The former implementation of "show volume" is relying on an index called rcn which is fed with every 7xx$w and 8xx$w subfield and therefore also shows predecessors and successors to the title.

This patch adds a new index only consisting of 773, 800, 810, 811 and 830 $w subfields called rcn-volumes.
This index is then used to display the "Show volumes" button and used to limit the results to volumes only.

Test plan:
0) set system preference  UseControlNumber to Use
a) import bug_39287.xml from the attachements f.e. via More -> Cataloging -> Stage records for import
   Format is MARCXML
b) After import search for "main" and open the record with "Main title"
c) Click on Show volumes
d) recognize search string is "rcn:cnmain NOT (bib-level:a OR bib-level:b)" and 4 results are found
e) apply patch
f) copy the necessary files to the zebra dirctory
  sudo cp -i etc/zebradb/biblios/etc/bib1.att /etc/koha/zebradb/biblios/etc/bib1.att
  sudo cp -i etc/zebradb/ccl.properties /etc/koha/zebradb/ccl.properties
  sudo cp -i etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
g) restart zebra: sudo koha-zebra --restart kohadev
h) rebuild the index: sudo koha-rebuild-zebra -b -f -v kohadev
i) restart_all
j) redo step b) to d)
k) recognize search string is now 'rcn-volumes:cnmain NOT (bib-level:a OR bib-level:b)' and only 2 records (volumes) are found
l) sign off
Comment 2 Jan Kissig 2025-05-23 12:27:25 UTC
Created attachment 182766 [details]
Record with volumes, predeccessor and successor
Comment 3 Anke Bruns 2025-10-08 14:18:18 UTC
Mit Zebra funktioniert der Patch, jedoch nicht, wenn die Instanz Elasticsearch nutzt.
Comment 4 Anke Bruns 2025-10-08 15:12:18 UTC
Created attachment 187584 [details] [review]
Bug 39287: Improve "Show volume" search with a more specialized search index

The former implementation of "show volume" is relying on an index called rcn which is fed with every 7xx$w and 8xx$w subfield and therefore also shows predecessors and successors to the title.

This patch adds a new index only consisting of 773, 800, 810, 811 and 830 $w subfields called rcn-volumes.
This index is then used to display the "Show volumes" button and used to limit the results to volumes only.

Test plan:
0) set system preference  UseControlNumber to Use
a) import bug_39287.xml from the attachements f.e. via More -> Cataloging -> Stage records for import
   Format is MARCXML
b) After import search for "main" and open the record with "Main title"
c) Click on Show volumes
d) recognize search string is "rcn:cnmain NOT (bib-level:a OR bib-level:b)" and 4 results are found
e) apply patch
f) copy the necessary files to the zebra dirctory
  sudo cp -i etc/zebradb/biblios/etc/bib1.att /etc/koha/zebradb/biblios/etc/bib1.att
  sudo cp -i etc/zebradb/ccl.properties /etc/koha/zebradb/ccl.properties
  sudo cp -i etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
g) restart zebra: sudo koha-zebra --restart kohadev
h) rebuild the index: sudo koha-rebuild-zebra -b -f -v kohadev
i) restart_all
j) redo step b) to d)
k) recognize search string is now 'rcn-volumes:cnmain NOT (bib-level:a OR bib-level:b)' and only 2 records (volumes) are found
l) sign off
Comment 5 Anke Bruns 2025-10-08 15:24:33 UTC
Created attachment 187588 [details] [review]
Test plan part 1: Zebra: 0) start instance with searchengine set to Zebra a) set system preference  UseControlNumber to Use b) import bug_39287.xml from the attachements f.e. via More -> Cataloging -> Stage records for import    Format is MARCXML c) After

Test plan part 2: Elasticsearch
0) start instance with searchengine set to Elasticsearch
a) Rebuild Elasticsearch index with --reset parameter to apply new mappings.
Redo test plan from part 1 step c) to d) and l)
m) sign off
Comment 6 Anke Bruns 2025-10-09 09:45:58 UTC
Sollten noch weitere Felder außer 773$w und 830$w für Show volumes abgefragt werden?
Comment 7 Katrin Fischer 2025-10-10 07:00:54 UTC
(In reply to Anke Bruns from comment #6)
> Sollten noch weitere Felder außer 773$w und 830$w für Show volumes abgefragt
> werden?

yes, the list of fields is in the first comment:

- 773$w (we still need to limit to monographic, because these could also be analytcal links)
- 800$w
- 810$w
- 811$w
- 830$w
Comment 8 Anke Bruns 2025-12-09 09:12:01 UTC
If the index rcn-volumes is used for the linking between parent and child records in multilevel records, why do we need the resp. w subfields of

800 - Series Added Entry - Personal Name (R) Full | Concise
810 - Series Added Entry - Corporate Name (R) Full | Concise
811 - Series Added Entry - Meeting Name (R) Full | Concise 

(copied from LOC MARC description).

Sorry for asking a potentially dumb question :-D
Comment 9 Katrin Fischer 2025-12-09 09:18:31 UTC
The linking between set and volumes is using different fields depending on if the volumes have dependent or independent titles. 

One uses 773, the other a combination of 8xx and 490. In the latter case the 8xx has the $w subfield we need to find them. So we can leave out 490, but we need all the other fields.
Comment 10 Anke Bruns 2025-12-11 15:33:52 UTC
I wasn't aware, thanks for clarifying.

So 800w, 810w and 811w should be added to the attachment; I'll see to it as soon as I manage to recover my testing environment :-D
Comment 11 Anke Bruns 2025-12-12 13:11:06 UTC
(In reply to Anke Bruns from comment #10)
> I wasn't aware, thanks for clarifying.
> 
> So 800w, 810w and 811w should be added to the attachment; I'll see to it as
> soon as I manage to recover my testing environment :-D

... I thought it was only in 830$w that a volume links to the parent record. So the link to the parent can also be in 800$w, 810$w or 811$w?
Comment 12 Katrin Fischer 2025-12-12 13:26:31 UTC
It could be, depending on the the main heading of the linked record is, if I understand correctly. But it could be that in practice it's not used that much.