From 405295e8ae7f0f8bf1ec1eff1b729dc800f0b209 Mon Sep 17 00:00:00 2001
From: Phil Ringnalda <phil@chetcolibrary.org>
Date: Mon, 24 Jun 2024 20:59:42 -0700
Subject: [PATCH] Bug 37167: Fix mapping call number searches to Z39.50

When you do an advanced search for call number, your search uses the index
callnum, but the code that maps your search to a possible Z39.50 search
still uses the index lcn,phr which was last used 15 years ago, so it's
treated as an unknown index and mapped to the Title field in the Z39.50
search form.

Test plan:
1. Click Search in the top menu to load Advanced Search
2. Change the dropdown menu for the first input from Keyword to Call
   Number, and paste TT174.3 in the input and search
3. Find the Z39.50/SRU search button in your results and click it
4. Note that your search was filled in the Title field
5. Apply patch, reset_all
6. Repeat steps 1-3, note that your search was filled in the Dewey field
7. Choose the server Library of Congress SRU and search
8. Note that even though we labelled it Dewey and you searched for an
   LC call number, your results are things with that call number in 050,
   the LC call number field.

Signed-off-by: David Nind <david@davidnind.com>
---
 catalogue/search.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalogue/search.pl b/catalogue/search.pl
index 998484d301..81f1214fd2 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -426,7 +426,7 @@ if ($params->{'limit-yr'}) {
 my $z3950par;
 my $indexes2z3950 = {
     kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
-    'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject',
+    'callnum'=>'dewey', su=>'subject', 'su,phr'=>'subject',
     ti=>'title', 'ti,phr'=>'title', se=>'title'
 };
 for (my $ii = 0; $ii < @operands; ++$ii)
-- 
2.39.2