From 676d9d3a9c744bcc56bfc16eb6138269ce5f31d6 Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 16 Dec 2007 19:30:15 +0000 Subject: [PATCH] add Z-style search/result interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@8223 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Search/Biblio.pm | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 86cfdb33bb..ec6afc3050 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -525,6 +525,57 @@ sub multiclass_query { return $data; } +__PACKAGE__->register_method( + method => 'cat_search_z_style_wrapper', + api_name => 'open-ils.search.biblio.zstyle', + stream => 1, + signature => q/@see open-ils.search.biblio.multiclass/); + +sub cat_search_z_style_wrapper { + my $self = shift; + my $client = shift; + my $authtoken = shift; + my $args = shift; + + my $result = { service => 'native-evergreen-catalog', records => [] }; + my $searchhash = { limit => $$args{limit}, offset => $$args{offset}}; + + $$searchhash{searches}{title} = $$args{search}{title}; + $$searchhash{searches}{author} = $$args{search}{author}; + $$searchhash{searches}{subject} = $$args{search}{subject}; + $$searchhash{searches}{keyword} = $$args{search}{keyword}; + $$searchhash{searches}{keyword} .= ' '.$$args{search}{tcn}; + $$searchhash{searches}{keyword} .= ' '.$$args{search}{isbn}; + $$searchhash{searches}{keyword} .= ' '.$$args{search}{publisher}; + $$searchhash{searches}{keyword} .= ' '.$$args{search}{pubdate}; + $$searchhash{searches}{keyword} .= ' '.$$args{search}{item_type}; + + my $list = $self->the_quest_for_knowledge( $client, $searchhash ); + + if ($list->{count} > 0) { + $result->{count} = $list->{count}; + + my $cstore = OpenSRF::AppSession->connect('open-ils.cstore'); + my $records = $cstore->request( + 'open-ils.cstore.direct.biblio.record_entry.search.atomic', + { id => [ map { ( $_->[0] ) } @{$list->{ids}} ] } + )->gather(1); + + for my $rec ( @$records ) { + + my $u = OpenILS::Utils::ModsParser->new(); + $u->start_mods_batch( $rec->marc ); + my $mods = $u->finish_mods_batch(); + + push @{ $result->{records} }, { mvr => $mods, marcxml => $rec->marc }; + + } + + } + + return $result; +} + # ---------------------------------------------------------------------------- # These are the main OPAC search methods # ---------------------------------------------------------------------------- @@ -561,8 +612,6 @@ __PACKAGE__->register_method( api_name => 'open-ils.search.metabib.multiclass.staff', signature => q/@see open-ils.search.biblio.multiclass/); - - sub the_quest_for_knowledge { my( $self, $conn, $searchhash, $docache ) = @_; -- 2.43.2