From daf06e3d9f956eefaaf79e5037e67c8cff342573 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 16 Jan 2012 11:30:13 -0500 Subject: [PATCH] Add an example SFX target parser for Evergreen catalogues The target parser is based on the JSPAC and serves up reasonable results for ISSN and ISBN-based searches, using the appropriate identifier indexes. Signed-off-by: Dan Scott --- Open-ILS/examples/sfx_target_parser/JSPAC.hlp | 100 ++++++++++++++++++++++++++ Open-ILS/examples/sfx_target_parser/JSPAC.pm | 85 ++++++++++++++++++++++ Open-ILS/examples/sfx_target_parser/README | 31 ++++++++ 3 files changed, 216 insertions(+) create mode 100644 Open-ILS/examples/sfx_target_parser/JSPAC.hlp create mode 100644 Open-ILS/examples/sfx_target_parser/JSPAC.pm create mode 100644 Open-ILS/examples/sfx_target_parser/README diff --git a/Open-ILS/examples/sfx_target_parser/JSPAC.hlp b/Open-ILS/examples/sfx_target_parser/JSPAC.hlp new file mode 100644 index 0000000000..d1d71076c8 --- /dev/null +++ b/Open-ILS/examples/sfx_target_parser/JSPAC.hlp @@ -0,0 +1,100 @@ + + + +sfxctrl + + + + + + +sfxctrl + + + + + + + +

PARSE_PARAM help for Evergreen JavaScript OPAC

+
+

This help file describes Target Parser information + for the Evergreen JavaScript OPAC. You will need this information only when editing this Target Service.
+
+
About PARSE_PARAM fields
+
PARSE_PARAM fields contain Target Parser information that is specific to + a particular Target Service or Object Portfolio. Two PARSE_PARAM fields exist + in the database:
+ 1. in the Target Service table : parameters that apply to the whole Target Service + (eg. base URL)
+ 2. in the Object Portfolio table : parameters that apply to one particular Object + Portfolio. (eg. jkey)
+ This file will show you which PARSE_PARAM fields to fill in for both the Target + Service level and the Object Portfolio level. More information on Target Parsers + can be found in the SFX User Guide.

+ +

General Information
+ Target - LOCAL_CATALOGUE_EVERGREEN_JSPAC
+ Service - getHolding
+ Parser - Evergreen::JSPAC

+
+

Information needed in the Target Service:
+In the PARSE_PARAM field, replace the following information: +
+eg_host = $$LOCAL_CATALOGUE_SERVER
+ eg_locale = Locale (en-US, en-CA, fr-CA, etc) + eg_skin = algoma, default, lul, nohin, uwin + eg_org_unit = 103, 1, etc + eg_depth = 0, 1, 2, 3, etc +

+

+

+ + + diff --git a/Open-ILS/examples/sfx_target_parser/JSPAC.pm b/Open-ILS/examples/sfx_target_parser/JSPAC.pm new file mode 100644 index 0000000000..1015e0274d --- /dev/null +++ b/Open-ILS/examples/sfx_target_parser/JSPAC.pm @@ -0,0 +1,85 @@ +package Parsers::TargetParser::Evergreen::JSPAC; +use Parsers::TargetParser; +use base qw(Parsers::TargetParser); +use strict; + +sub getHolding { + my ($this,$genRequestObj) = @_; + + my $objectType = $genRequestObj->{'objectType'}; + my $ISBN = $genRequestObj->{'ISBN'}; + my $eISBN = $genRequestObj->{'eISBN'}; + my $ISSN = $genRequestObj->{'ISSN'}; + my $eISSN = $genRequestObj->{'eISSN'}; + + my $CODEN = $genRequestObj->{'CODEN'}; + my $bookTitle = $genRequestObj->{'bookTitle'}; + my $journalTitle = $genRequestObj->{'journalTitle'}; + my $articleTitle = $genRequestObj->{'articleTitle'}; + my $confTitle = $genRequestObj->{'confTitle'}; + + my $abbrevTitle = $genRequestObj->{'@abbrevTitle'}; + my $volume = $genRequestObj->{'volume'}; + my $issue = $genRequestObj->{'issue'}; + my $startPage = $genRequestObj->{'startPage'}; + my $endPage = $genRequestObj->{'endPage'}; + + my $year = $genRequestObj->{'year'}; + my $month = $genRequestObj->{'month'}; + my $day = $genRequestObj->{'day'}; + my $SICI = $genRequestObj->{'SICI'}; + my $BICI = $genRequestObj->{'BICI'}; + + my $doi = $genRequestObj->{'doi'}; + my $archive = $genRequestObj->{'archive'}; + my $archiveId = $genRequestObj->{'archiveId'}; + my $authLast = $genRequestObj->{'@authLast'}; + my $authFirst = $genRequestObj->{'@authFirst'}; + + my $authInit = $genRequestObj->{'@authInit'}; + my $medUID = $genRequestObj->{'medUID'}; + my $tickUID = $genRequestObj->{'tickUID'}; + my $subject = $genRequestObj->{'subject'}; + my $attribute = $genRequestObj->{'@attribute'}; + + my $user = $genRequestObj->{'user'}; + my $quarter = $genRequestObj->{'quarter'}; + my $part = $genRequestObj->{'part'}; + my $patent = $genRequestObj->{'patent'}; + my $ssn = $genRequestObj->{'ssn'}; + + + # Canonical search results URL for simple searches: + # http://hostname/opac/en-US/skin/lul/xml/rresult.xml?rt=keyword&tp=keyword&t=0895-2779&l=105&d=2&f=&av= + + my $svc = $this->{svc}; + my $egHost = $svc->parse_param('eg_host'); + my $egLocale = $svc->parse_param('eg_locale'); + my $egSkin = $svc->parse_param('eg_skin'); + my $egOrgUnit = $svc->parse_param('eg_org_unit'); + my $egDepth = $svc->parse_param('eg_depth'); + + my $path = "http://${egHost}/opac/${egLocale}/skin/${egSkin}/xml/rresult.xml?l=${egOrgUnit}&d=${egDepth}"; + + my $searchString = '&rt=keyword&tp=keyword&t='; + + if (defined($ISSN)) { + $searchString .= "identifier|issn: $ISSN"; + } + elsif (defined($ISBN)) { + # Strip hyphens + $ISBN =~ s/-//g; + $searchString .= "dentifier|isbn: $ISBN"; + } + elsif (defined($journalTitle)) { + $searchString .= "ti:${journalTitle}&bl=s"; + } + elsif (defined($bookTitle)) { + $searchString .= "ti:${bookTitle}&bl=m"; + } + + return ($path . $searchString); + +} + +1; diff --git a/Open-ILS/examples/sfx_target_parser/README b/Open-ILS/examples/sfx_target_parser/README new file mode 100644 index 0000000000..df6edc100c --- /dev/null +++ b/Open-ILS/examples/sfx_target_parser/README @@ -0,0 +1,31 @@ +README for SFX target parser for Evergreen +========================================== +Dan Scott + +This directory includes an example SFX target parser for Evergreen that uses +the JavaScript-based OPAC (JSPAC) as its target. It assumes the existence of +identifier|issn and identifier|isbn indexes (available by default as of +Evergreen 2.0). The code was based on my work as documented at +http://coffeecode.net/archives/194-SFX-target-parser-for-Evergreen-and-some-thoughts-about-searching-identifiers.html +but updated for Evergreen 2.0, made more generic for an Evergreen audience, +and targeted at the JSPAC in the knowledge that TPAC is coming. + +1. Create a SFX target parser Evergreen directory, adjusting the SFX path and + instance name according to your needs: ++ +[source,bash] +------------------------------------------------------------------------------ +mkdir /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen +------------------------------------------------------------------------------ ++ +2. Copy the JSPAC.hlp and JSPAC.pm files into your SFX target parser Evergreen + directory: ++ +[source,bash] +------------------------------------------------------------------------------ +cp JSPAC* /exlibris/sfx_ver/sfx4_1//lib/Parsers/TargetParser/Evergreen +------------------------------------------------------------------------------ ++ +3. Restart SFX to enable it to recognize the new target parser. +4. Add and configure the new target parser in the SFX Administration, passing + in the variables such as locale, target search library, and search depth. -- 2.11.0