Bug 36991

Summary: Add ability to scan call numbers index/search field
Product: Koha Reporter: Janusz Kaczmarek <januszop>
Component: SearchingAssignee: Janusz Kaczmarek <januszop>
Status: Needs documenting --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: lucas, m.de.rooy, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This adds 'call number' to the available search options when using the 'scan indexes' feature from the advanced search page in the staff interface.
Version(s) released in:
24.11.00
Circulation function:
Attachments: Bug 36991: Add ability to scan call numbers index/search field
Bug 36991: Add ability to scan call numbers index/search field
Bug 36991: Add ability to scan call numbers index/search field

Description Janusz Kaczmarek 2024-05-29 19:38:53 UTC
Some libraries ask for the ability to scan/browse the call numbers index.
Comment 1 Janusz Kaczmarek 2024-05-29 19:56:08 UTC
Created attachment 167249 [details] [review]
Bug 36991: Add ability to scan call numbers index/search field

Some libraries ask for the ability to scan/browse the call numbers index.

Test plan:
==========
1. Have an installation with items with callnumbers (in ktd with standard
   test data set: add some callnumbers to the items).
2. Go to Advanced search > More options; choose Call number in the first
   drop list and mark Scan indexes.  Enter one of the call numbers you
   assigned to the items and perform the search.  You should get no
   results.
3. Apply the pach; restart all; when using ES:
   koha-elasticsearch --rebuild -r -d kohadev
4. Repeat p. 2.  You should get a list with at least one call number.
   The link should lead you to the record(s) with items with the selected
   call number.

This should work for ES and for Zebra, but for Zebra you would need to
replace /etc/koha/zebradb/ccl.properties with the repository version; and
you will get one token results on the list, like for other indexes.
Comment 2 Roman Dolny 2024-05-30 07:07:07 UTC
Created attachment 167266 [details] [review]
Bug 36991: Add ability to scan call numbers index/search field

Some libraries ask for the ability to scan/browse the call numbers index.

Test plan:
==========
1. Have an installation with items with callnumbers (in ktd with standard
   test data set: add some callnumbers to the items).
2. Go to Advanced search > More options; choose Call number in the first
   drop list and mark Scan indexes.  Enter one of the call numbers you
   assigned to the items and perform the search.  You should get no
   results.
3. Apply the pach; restart all; when using ES:
   koha-elasticsearch --rebuild -r -d kohadev
4. Repeat p. 2.  You should get a list with at least one call number.
   The link should lead you to the record(s) with items with the selected
   call number.

This should work for ES and for Zebra, but for Zebra you would need to
replace /etc/koha/zebradb/ccl.properties with the repository version; and
you will get one token results on the list, like for other indexes.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Marcel de Rooy 2024-11-01 10:42:45 UTC
diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties
index 985f7391bc..a71ea8f4c4 100644
--- a/etc/zebradb/ccl.properties
+++ b/etc/zebradb/ccl.properties
@@ -1039,7 +1039,7 @@ stack 1=8018

-Local-classification 1=8022
+#Local-classification 1=8022

What about bib1.att ?
att 20    Local-classification
att 8022    Local-classification

No blocker
Comment 4 Marcel de Rooy 2024-11-01 10:47:34 UTC
+    'callnum' => 'local-classification',

And yet another one :) Wouldnt something like callnum(ber) not be easier?
No blocker
Comment 5 Marcel de Rooy 2024-11-01 10:54:28 UTC
Created attachment 173863 [details] [review]
Bug 36991: Add ability to scan call numbers index/search field

Some libraries ask for the ability to scan/browse the call numbers index.

Test plan:
==========
1. Have an installation with items with callnumbers (in ktd with standard
   test data set: add some callnumbers to the items).
2. Go to Advanced search > More options; choose Call number in the first
   drop list and mark Scan indexes.  Enter one of the call numbers you
   assigned to the items and perform the search.  You should get no
   results.
3. Apply the pach; restart all; when using ES:
   koha-elasticsearch --rebuild -r -d kohadev
4. Repeat p. 2.  You should get a list with at least one call number.
   The link should lead you to the record(s) with items with the selected
   call number.

This should work for ES and for Zebra, but for Zebra you would need to
replace /etc/koha/zebradb/ccl.properties with the repository version; and
you will get one token results on the list, like for other indexes.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2024-11-01 10:55:05 UTC
Nick, still care to take a quick look at Elastic part ?
Comment 7 Janusz Kaczmarek 2024-11-01 16:00:04 UTC
(In reply to Marcel de Rooy from comment #4)
> +    'callnum' => 'local-classification',
> 
> And yet another one :) Wouldnt something like callnum(ber) not be easier?

This is for consistency.  We have 'callnum' in indexex list in C4::Search, we call it callnum in ccl.properties.  Search string for callnumber resulting from advanced search has idx=callnum etc.

And internal name of the ES search field is 'local-classification', so we need the mapping.
Comment 8 Janusz Kaczmarek 2024-11-01 16:51:03 UTC
(In reply to Marcel de Rooy from comment #3)
> diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties
> index 985f7391bc..a71ea8f4c4 100644
> --- a/etc/zebradb/ccl.properties
> +++ b/etc/zebradb/ccl.properties
> @@ -1039,7 +1039,7 @@ stack 1=8018
> 
> -Local-classification 1=8022
> +#Local-classification 1=8022
> 
> What about bib1.att ?
> att 20    Local-classification
> att 8022    Local-classification
> 
> No blocker

This is a good question.  The point is that this duplicate in ccl.properties:

Local-classification 1=8022
Local-classification 1=20

together with:

callnum Local-classification

creates problems with scanning. The official id for Local-classification (from LoC) is 20, so I decided to leave 20 and remove 8022. 

Currently, in Zebra, we index 952 $o with Local-classification index (cf. biblio-zebra-indexdefs.xsl).  This means, it is searchable with pqf queries like 
@attr 1=Local-classification, @attr 1=20 and @attr 1=8022.

With the current mapping in ccl.properties search for callnum produces following PQF query (mind "callnum Local-classification" in ccl.properties):

@or @attr 1=20 XXX @attr 1=8022 XXX

After the removal of 8022 from ccl.properties we get just:

@attr 1=20 XXX 

And this allows for scanning.

So, it looks OK, IMO.  Or maybe we should remove the 8022 line from bib1? It should not hurt nothing (we do not use 8022 directly).
Comment 9 Nick Clemens (kidclamp) 2024-11-07 13:00:17 UTC
(In reply to Marcel de Rooy from comment #6)
> Nick, still care to take a quick look at Elastic part ?

Looks good and works for me
Comment 10 Katrin Fischer 2024-11-08 15:44:44 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 11 Lucas Gass (lukeg) 2024-11-22 21:45:55 UTC
Enhancement, no 24.05.x backport.