From b037d55ebd447554f23a3677d1536d8402460b5c Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Wed, 30 May 2012 11:02:51 -0400 Subject: [PATCH] Bug 8206: Specify index in OPAC authority search Content-Type: text/plain; charset="UTF-8" Adds a dropdown to allow the user to choose to search the 'mainentry,' and 'match-heading'indexes, in addition to the 'any' index which is the default. To test (you will need authority records with see-from and see-also headings): 1. Go to the browse subjects and authors section in the OPAC 2. Do a search for a fairly generic term that is used as a see-also term in a lot of records. Note that your search results include both the record that you wanted and all the other records that refer to it. 3. Apply the patch. 4. Repeat the search from step 2. Notice there is no change to the results. 5. Repeat the search from step 2, but choose "in main entry" and observe that you are now only seeing authority records with the search entered in their main entry. 6. Repeat the search from step 2, but choose "in any heading" and observe that the results are the same as in step 2. This is intentional, so that in the future notes in authorities can be made searchable. 7. Search for an obsolete form of heading with the "in keyword" option selected. Notice what results you get. --- C4/AuthoritiesMarc.pm | 8 ++++---- .../prog/en/modules/opac-authorities-home.tt | 15 ++++++++++----- opac/opac-authorities-home.pl | 20 ++++++-------------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 5ea5098..9d30f70 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -199,7 +199,7 @@ sub SearchAuthorities { } } else { my $query; - my $attr; + my $attr = ''; # the marclist may contain "mainentry". In this case, search the tag_to_report, that depends on # the authtypecode. Then, search on $a of this tag_to_report # also store main entry MARC tag, to extract it at end of search @@ -230,9 +230,6 @@ sub SearchAuthorities { elsif ( @$tags[$i] eq "mainentry" ) { $attr = " \@attr 1=Heading "; } - elsif ( @$tags[$i] eq "any" ) { - $attr = " \@attr 1=Any "; - } elsif ( @$tags[$i] eq "match" ) { $attr = " \@attr 1=Match "; } @@ -245,6 +242,9 @@ sub SearchAuthorities { elsif ( @$tags[$i] eq "thesaurus" ) { $attr = " \@attr 1=Subject-heading-thesaurus "; } + else { # Assume any if no index was specified + $attr = " \@attr 1=Any "; + } if ( @$operator[$i] eq 'is' ) { $attr .= " \@attr 4=1 \@attr 5=100 " ; ##Phrase, No truncation,all of subfield field must match diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tt index 04d5a8c..5fc13e4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tt @@ -22,15 +22,20 @@ [% END %] [% END %] - - - - - + + + + +