[open-ils-commits] r16068 - in trunk: Open-ILS/src/perlmods/OpenILS/Application/Search Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher build/tools (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 31 09:31:30 EDT 2010


Author: erickson
Date: 2010-03-31 09:31:28 -0400 (Wed, 31 Mar 2010)
New Revision: 16068

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
   trunk/build/tools/update_db.sh
Log:
Patch from Joe Atzberger to add additional code docs and more code cleanup

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2010-03-31 07:43:46 UTC (rev 16067)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2010-03-31 13:31:28 UTC (rev 16068)
@@ -74,7 +74,7 @@
 	while( my $resp = $request->recv ) {
 		my $content = $resp->content;
 		next if $content->id == OILS_PRECAT_RECORD;
-		my $u = OpenILS::Utils::ModsParser->new();
+		my $u = OpenILS::Utils::ModsParser->new();  # FIXME: we really need a new parser for each object?
 		$u->start_mods_batch( $content->marc );
 		my $mods = $u->finish_mods_batch();
 		$mods->doc_id($content->id());
@@ -87,35 +87,51 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_mods",
-	api_name	=> "open-ils.search.biblio.record.mods.retrieve",
-	argc		=> 1, 
-	note		=> "Provide ID, we provide the mods"
+    method    => "record_id_to_mods",
+    api_name  => "open-ils.search.biblio.record.mods.retrieve",
+    argc      => 1,
+    signature => {
+        desc   => "Provide ID, we provide the MODS object with copy count.  " 
+                . "Note: this method does NOT take an array of IDs like mods_slim.retrieve",    # FIXME: do it here too
+        params => [
+            { desc => 'Record ID', type => 'number' }
+        ],
+        return => {
+            desc => 'MODS object', type => 'object'
+        }
+    }
 );
 
 # converts a record into a mods object with copy counts attached
 sub record_id_to_mods {
 
-	my( $self, $client, $org_id, $id ) = @_;
+    my( $self, $client, $org_id, $id ) = @_;
 
-	my $mods_list = _records_to_mods( $id );
-	my $mods_obj = $mods_list->[0];
-	my $cmethod = $self->method_lookup(
-			"open-ils.search.biblio.record.copy_count");
-	my ($count) = $cmethod->run($org_id, $id);
-	$mods_obj->copy_count($count);
+    my $mods_list = _records_to_mods( $id );
+    my $mods_obj  = $mods_list->[0];
+    my $cmethod   = $self->method_lookup("open-ils.search.biblio.record.copy_count");
+    my ($count)   = $cmethod->run($org_id, $id);
+    $mods_obj->copy_count($count);
 
-	return $mods_obj;
+    return $mods_obj;
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_mods_slim",
+    method        => "record_id_to_mods_slim",
+    api_name      => "open-ils.search.biblio.record.mods_slim.retrieve",
+    argc          => 1,
     authoritative => 1,
-	api_name	=> "open-ils.search.biblio.record.mods_slim.retrieve",
-	argc		=> 1, 
-	note		=> "Provide ID, we provide the mods"
+    signature     => {
+        desc   => "Provide ID(s), we provide the MODS",
+        params => [
+            { desc => 'Record ID or array of IDs' }
+        ],
+        return => {
+            desc => 'MODS object(s), event on error'
+        }
+    }
 );
 
 # converts a record into a mods object with NO copy counts attached
@@ -127,7 +143,7 @@
 		return _records_to_mods( @$id );
 	}
 	my $mods_list = _records_to_mods( $id );
-	my $mods_obj = $mods_list->[0];
+	my $mods_obj  = $mods_list->[0];
 	return OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND') unless $mods_obj;
 	return $mods_obj;
 }
@@ -135,9 +151,9 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_mods_slim_batch",
-	api_name	=> "open-ils.search.biblio.record.mods_slim.batch.retrieve",
-    stream => 1
+    method   => "record_id_to_mods_slim_batch",
+    api_name => "open-ils.search.biblio.record.mods_slim.batch.retrieve",
+    stream   => 1
 );
 sub record_id_to_mods_slim_batch {
 	my($self, $conn, $id_list) = @_;
@@ -148,24 +164,24 @@
 
 # Returns the number of copies attached to a record based on org location
 __PACKAGE__->register_method(
-	method	=> "record_id_to_copy_count",
-	api_name	=> "open-ils.search.biblio.record.copy_count",
+    method   => "record_id_to_copy_count",
+    api_name => "open-ils.search.biblio.record.copy_count",
 );
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_copy_count",
+    method        => "record_id_to_copy_count",
+    api_name      => "open-ils.search.biblio.record.copy_count.staff",
     authoritative => 1,
-	api_name	=> "open-ils.search.biblio.record.copy_count.staff",
 );
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_copy_count",
-	api_name	=> "open-ils.search.biblio.metarecord.copy_count",
+    method   => "record_id_to_copy_count",
+    api_name => "open-ils.search.biblio.metarecord.copy_count",
 );
 
 __PACKAGE__->register_method(
-	method	=> "record_id_to_copy_count",
-	api_name	=> "open-ils.search.biblio.metarecord.copy_count.staff",
+    method   => "record_id_to_copy_count",
+    api_name => "open-ils.search.biblio.metarecord.copy_count.staff",
 );
 sub record_id_to_copy_count {
 	my( $self, $client, $org_id, $record_id, $format ) = @_;
@@ -190,35 +206,34 @@
 }
 
 
-
-
 __PACKAGE__->register_method(
-	method	=> "biblio_search_tcn",
-	api_name	=> "open-ils.search.biblio.tcn",
-	argc		=> 3, 
-	note		=> "Retrieve a record by TCN",
+    method   => "biblio_search_tcn",
+    api_name => "open-ils.search.biblio.tcn",
+    argc     => 3,
+    note     => "Retrieve a record by TCN",
 );
 
 sub biblio_search_tcn {
 
-	my( $self, $client, $tcn, $include_deleted ) = @_;
+    my( $self, $client, $tcn, $include_deleted ) = @_;
 
     $tcn =~ s/^\s+|\s+$//og;
 
-	my $e = new_editor();
-   my $search = {tcn_value => $tcn};
-   $search->{deleted} = 'f' unless $include_deleted;
-	my $recs = $e->search_biblio_record_entry( $search, {idlist =>1} );
+    my $e = new_editor();
+    my $search = {tcn_value => $tcn};
+    $search->{deleted} = 'f' unless $include_deleted;
+    my $recs = $e->search_biblio_record_entry( $search, {idlist =>1} );
 	
-	return { count => scalar(@$recs), ids => $recs };
+    return { count => scalar(@$recs), ids => $recs };
 }
 
 
 # --------------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method	=> "biblio_barcode_to_copy",
-	api_name	=> "open-ils.search.asset.copy.find_by_barcode",);
+    method   => "biblio_barcode_to_copy",
+    api_name => "open-ils.search.asset.copy.find_by_barcode",
+);
 sub biblio_barcode_to_copy { 
 	my( $self, $client, $barcode ) = @_;
 	my( $copy, $evt ) = $U->fetch_copy_by_barcode($barcode);
@@ -227,8 +242,9 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "biblio_id_to_copy",
-	api_name	=> "open-ils.search.asset.copy.batch.retrieve",);
+    method   => "biblio_id_to_copy",
+    api_name => "open-ils.search.asset.copy.batch.retrieve",
+);
 sub biblio_id_to_copy { 
 	my( $self, $client, $ids ) = @_;
 	$logger->info("Fetching copies @$ids");
@@ -304,8 +320,9 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "copy_retrieve", 
-	api_name	=> "open-ils.search.asset.copy.retrieve",);
+    method   => "copy_retrieve",
+    api_name => "open-ils.search.asset.copy.retrieve",
+);
 sub copy_retrieve {
 	my( $self, $client, $cid ) = @_;
 	my( $copy, $evt ) = $U->fetch_copy($cid);
@@ -314,8 +331,9 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "volume_retrieve", 
-	api_name	=> "open-ils.search.asset.call_number.retrieve");
+    method   => "volume_retrieve",
+    api_name => "open-ils.search.asset.call_number.retrieve"
+);
 sub volume_retrieve {
 	my( $self, $client, $vid ) = @_;
 	my $e = new_editor();
@@ -324,9 +342,10 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "fleshed_copy_retrieve_batch",
+    method        => "fleshed_copy_retrieve_batch",
+    api_name      => "open-ils.search.asset.copy.fleshed.batch.retrieve",
     authoritative => 1,
-	api_name	=> "open-ils.search.asset.copy.fleshed.batch.retrieve");
+);
 
 sub fleshed_copy_retrieve_batch { 
 	my( $self, $client, $ids ) = @_;
@@ -341,8 +360,9 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "fleshed_copy_retrieve",
-	api_name	=> "open-ils.search.asset.copy.fleshed.retrieve",);
+    method   => "fleshed_copy_retrieve",
+    api_name => "open-ils.search.asset.copy.fleshed.retrieve",
+);
 
 sub fleshed_copy_retrieve { 
 	my( $self, $client, $id ) = @_;
@@ -352,10 +372,9 @@
 }
 
 
-
 __PACKAGE__->register_method(
-	method => 'fleshed_by_barcode',
-	api_name	=> "open-ils.search.asset.copy.fleshed2.find_by_barcode",
+    method        => 'fleshed_by_barcode',
+    api_name      => "open-ils.search.asset.copy.fleshed2.find_by_barcode",
     authoritative => 1,
 );
 sub fleshed_by_barcode {
@@ -369,8 +388,8 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "fleshed_copy_retrieve2",
-	api_name	=> "open-ils.search.asset.copy.fleshed2.retrieve",
+    method        => "fleshed_copy_retrieve2",
+    api_name      => "open-ils.search.asset.copy.fleshed2.retrieve",
     authoritative => 1,
 );
 
@@ -380,13 +399,15 @@
 	my $copy = $e->retrieve_asset_copy(
 		[
 			$id,
-			{ 
-				flesh				=> 2,
-				flesh_fields	=> { 
-					acp => [ qw/ location status stat_cat_entry_copy_maps notes age_protect / ],
-					ascecm => [ qw/ stat_cat stat_cat_entry / ],
-				}
-			}
+            {
+                flesh        => 2,
+                flesh_fields => {
+                    acp => [
+                        qw/ location status stat_cat_entry_copy_maps notes age_protect /
+                    ],
+                    ascecm => [qw/ stat_cat stat_cat_entry /],
+                }
+            }
 		]
 	) or return $e->event;
 
@@ -412,8 +433,8 @@
 
 
 __PACKAGE__->register_method(
-	method => 'flesh_copy_custom',
-	api_name => 'open-ils.search.asset.copy.fleshed.custom',
+    method        => 'flesh_copy_custom',
+    api_name      => 'open-ils.search.asset.copy.fleshed.custom',
     authoritative => 1,
 );
 
@@ -435,13 +456,9 @@
 }
 
 
-
-
-
-
 __PACKAGE__->register_method(
-	method	=> "biblio_barcode_to_title",
-	api_name	=> "open-ils.search.biblio.find_by_barcode",
+    method   => "biblio_barcode_to_title",
+    api_name => "open-ils.search.biblio.find_by_barcode",
 );
 
 sub biblio_barcode_to_title {
@@ -456,9 +473,18 @@
 }
 
 __PACKAGE__->register_method(
-    method => 'title_id_by_item_barcode',
-    api_name => 'open-ils.search.bib_id.by_barcode',
+    method        => 'title_id_by_item_barcode',
+    api_name      => 'open-ils.search.bib_id.by_barcode',
     authoritative => 1,
+    signature => { 
+        desc   => 'Retrieve copy object with fleshed record, given the barcode',
+        params => [
+            { desc => 'Item barcode', type => 'string' }
+        ],
+        return => {
+            desc => 'Asset copy object with fleshed record and callnumber, or event on error or null set'
+        }
+    }
 );
 
 sub title_id_by_item_barcode {
@@ -483,8 +509,8 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "biblio_copy_to_mods",
-	api_name	=> "open-ils.search.biblio.copy.mods.retrieve",
+    method   => "biblio_copy_to_mods",
+    api_name => "open-ils.search.biblio.copy.mods.retrieve",
 );
 
 # takes a copy object and returns it fleshed mods object
@@ -504,6 +530,14 @@
 }
 
 
+=head1 NAME
+
+OpenILS::Application::Search::Biblio
+
+=head1 DESCRIPTION
+
+=head2 API METHODS
+
 =head3 open-ils.search.biblio.multiclass.query (arghash, query, docache)
 
 For arghash and docache, see B<open-ils.search.biblio.multiclass>.
@@ -530,12 +564,17 @@
 
 =cut
 
+foreach (qw/open-ils.search.biblio.multiclass.query
+            open-ils.search.biblio.multiclass.query.staff
+            open-ils.search.metabib.multiclass.query
+            open-ils.search.metabib.multiclass.query.staff/)
+{
 __PACKAGE__->register_method(
-    api_name  => 'open-ils.search.biblio.multiclass.query',
+    api_name  => $_,
     method    => 'multiclass_query',
     signature => {
-        desc   => 'Perform a search query',
-        param  => [
+        desc   => 'Perform a search query.  The .staff version of the call includes otherwise hidden hits.',
+        params => [
             {name => 'arghash', desc => 'Arg hash (see open-ils.search.biblio.multiclass)',         type => 'object'},
             {name => 'query',   desc => 'Raw human-readable query (see perldoc '. __PACKAGE__ .')', type => 'string'},
             {name => 'docache', desc => 'Flag for caching (see open-ils.search.biblio.multiclass)', type => 'object'},
@@ -546,21 +585,7 @@
         }
     }
 );
-__PACKAGE__->register_method(
-    api_name  => 'open-ils.search.biblio.multiclass.query.staff',
-    method    => 'multiclass_query',
-    signature => '@see open-ils.search.biblio.multiclass.query'
-);
-__PACKAGE__->register_method(
-    api_name  => 'open-ils.search.metabib.multiclass.query',
-    method    => 'multiclass_query',
-    signature => '@see open-ils.search.biblio.multiclass.query'
-);
-__PACKAGE__->register_method(
-    api_name  => 'open-ils.search.metabib.multiclass.query.staff',
-    method    => 'multiclass_query',
-    signature => '@see open-ils.search.biblio.multiclass.query'
-);
+}
 
 sub multiclass_query {
     my($self, $conn, $arghash, $query, $docache) = @_;
@@ -583,8 +608,8 @@
     $logger->debug("cleansed query string => $query");
     my $search = {};
 
-    my $simple_class_re = qr/((?:\w+(?:\|\w+)?):[^:]+?)$/;
-    my $class_list_re = qr/(?:keyword|title|author|subject|series)/;
+    my $simple_class_re  = qr/((?:\w+(?:\|\w+)?):[^:]+?)$/;
+    my $class_list_re    = qr/(?:keyword|title|author|subject|series)/;
     my $modifier_list_re = qr/(?:site|dir|sort|lang|available)/;
 
     my $tmp_value = '';
@@ -592,7 +617,7 @@
 
         my $qpart = $1;
         my $where = index($qpart,':');
-        my $type = substr($qpart, 0, $where++);
+        my $type  = substr($qpart, 0, $where++);
         my $value = substr($qpart, $where);
 
         if ($type !~ /^(?:$class_list_re|$modifier_list_re)/o) {
@@ -691,16 +716,18 @@
 }
 
 __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/);
+    method    => 'cat_search_z_style_wrapper',
+    api_name  => 'open-ils.search.biblio.zstyle',
+    stream    => 1,
+    signature => q/@see open-ils.search.biblio.multiclass/
+);
 
 __PACKAGE__->register_method(
-	method		=> 'cat_search_z_style_wrapper',
-	api_name	=> 'open-ils.search.biblio.zstyle.staff',
-	stream		=> 1,
-	signature	=> q/@see open-ils.search.biblio.multiclass/);
+    method    => 'cat_search_z_style_wrapper',
+    api_name  => 'open-ils.search.biblio.zstyle.staff',
+    stream    => 1,
+    signature => q/@see open-ils.search.biblio.multiclass/
+);
 
 sub cat_search_z_style_wrapper {
 	my $self = shift;
@@ -718,8 +745,8 @@
 	my $result = { service => 'native-evergreen-catalog', records => [] };
 	my $searchhash = { limit => $$args{limit}, offset => $$args{offset}, org_unit => $ou->id };
 
-	$$searchhash{searches}{title}{term} = $$args{search}{title} if $$args{search}{title};
-	$$searchhash{searches}{author}{term} = $$args{search}{author} if $$args{search}{author};
+	$$searchhash{searches}{title}{term}   = $$args{search}{title}   if $$args{search}{title};
+	$$searchhash{searches}{author}{term}  = $$args{search}{author}  if $$args{search}{author};
 	$$searchhash{searches}{subject}{term} = $$args{search}{subject} if $$args{search}{subject};
 	$$searchhash{searches}{keyword}{term} = $$args{search}{keyword} if $$args{search}{keyword};
 
@@ -763,26 +790,63 @@
 __PACKAGE__->register_method(
     method    => 'the_quest_for_knowledge',
     api_name  => 'open-ils.search.biblio.multiclass',
-    signature => q/
-		Performs a multi class biblio or metabib search
-		@param searchhash A search object layed out like so:
-			searches : { "$class" : "$value", ...}
-			org_unit : The org id to focus the search at
-			depth		: The org depth
-			limit		: The search limit
-			offset	: The search offset
-			format	: The MARC format
-			sort		: What field to sort the results on [ author | title | pubdate ]
-			sort_dir	: What direction do we sort? [ asc | desc ]
-		@return An object of the form 
-			{ "count" : $count, "ids" : [ [ $id, $relevancy, $total ], ...] }
-	/
+    signature => {
+        desc => "Performs a multi class biblio or metabib search",
+        params => [
+            {
+                desc => "A search hash with keys: "
+                      . "searches, org_unit, depth, limit, offset, format, sort, sort_dir.  "
+                      . "See perldoc " . __PACKAGE__ . " for more detail",
+                type => 'object',
+            },
+            {
+                desc => "A flag to enable/disable searching and saving results in cache (default OFF)",
+                type => 'string',
+            }
+        ],
+        return => {
+            desc => 'An object of the form: '
+                  . '{ "count" : $count, "ids" : [ [ $id, $relevancy, $total ], ...] }',
+        }
+    }
 );
 
+=head3 open-ils.search.biblio.multiclass (search-hash, docache)
+
+The search-hash argument can have the following elements:
+
+    searches: { "$class" : "$value", ...}           [REQUIRED]
+    org_unit: The org id to focus the search at
+    depth   : The org depth     
+    limit   : The search limit      default: 10
+    offset  : The search offset     default:  0
+    format  : The MARC format
+    sort    : What field to sort the results on? [ author | title | pubdate ]
+    sort_dir: What direction do we sort? [ asc | desc ]
+
+The searches element is required, must have a hashref value, and the hashref must contain at least one 
+of the following classes as a key:
+
+    title
+    author
+    subject
+    series
+    keyword
+
+The value paired with a key is the associated search string.
+
+The docache argument enables/disables searching and saving results in cache (default OFF).
+
+The return object, if successful, will look like:
+
+    { "count" : $count, "ids" : [ [ $id, $relevancy, $total ], ...] }
+
+=cut
+
 __PACKAGE__->register_method(
     method    => 'the_quest_for_knowledge',
     api_name  => 'open-ils.search.biblio.multiclass.staff',
-    signature => q/@see open-ils.search.biblio.multiclass/
+    signature => q/The .staff search includes hidden bibs, hidden items and bibs with no items.  Otherwise, @see open-ils.search.biblio.multiclass/
 );
 __PACKAGE__->register_method(
     method    => 'the_quest_for_knowledge',
@@ -792,7 +856,7 @@
 __PACKAGE__->register_method(
     method    => 'the_quest_for_knowledge',
     api_name  => 'open-ils.search.metabib.multiclass.staff',
-    signature => q/@see open-ils.search.biblio.multiclass/
+    signature => q/The .staff search includes hidden bibs, hidden items and bibs with no items.  Otherwise, @see open-ils.search.biblio.multiclass/
 );
 
 sub the_quest_for_knowledge {
@@ -810,21 +874,19 @@
 		$method =~ s/biblio/metabib/o;
 	}
 
-
-	my $offset	= $searchhash->{offset} || 0;
-	my $limit	= $searchhash->{limit} || 10;
-	my $end		= $offset + $limit - 1;
-
 	# do some simple sanity checking
 	if(!$searchhash->{searches} or
 		( !grep { /^(?:title|author|subject|series|keyword)/ } keys %{$searchhash->{searches}} ) ) {
 		return { count => 0 };
 	}
 
+    my $offset = $searchhash->{offset} ||  0;   # user value or default in local var now
+    my $limit  = $searchhash->{limit}  || 10;   # user value or default in local var now
+    my $end    = $offset + $limit - 1;
 
 	my $maxlimit = 5000;
-	$searchhash->{offset}	= 0;
-	$searchhash->{limit}		= $maxlimit;
+    $searchhash->{offset} = 0;                  # possible user value overwritten in hash
+    $searchhash->{limit}  = $maxlimit;          # possible user value overwritten in hash
 
 	return { count => 0 } if $offset > $maxlimit;
 
@@ -855,7 +917,7 @@
         $trim = 1;
 
 	} else { 
-		$docache = 0; 
+		$docache = 0;   # results came FROM cache, so we don't write back
 	}
 
 	return {count => 0} unless ($result && $$result[0]);
@@ -887,20 +949,45 @@
 
 
 __PACKAGE__->register_method(
-	method		=> 'staged_search',
-	api_name	=> 'open-ils.search.biblio.multiclass.staged');
+    method    => 'staged_search',
+    api_name  => 'open-ils.search.biblio.multiclass.staged',
+    signature => {
+        desc   => 'Staged search filters out unavailable items.  This means that it relies on an estimation strategy for determining ' .
+                  'how big a "raw" search result chunk (i.e. a "superpage") to obtain prior to filtering.  See "estimation_strategy" in your SRF config.',
+        params => [
+            {
+                desc => "A search hash with keys: "
+                      . "searches, limit, offset.  The others are optional, but the 'searches' key/value pair is required, with the value being a hashref.  "
+                      . "See perldoc " . __PACKAGE__ . " for more detail",
+                type => 'object',
+            },
+            {
+                desc => "A flag to enable/disable searching and saving results in cache, including facets (default OFF)",
+                type => 'string',
+            }
+        ],
+        return => {
+            desc => 'Hash with keys: count, core_limit, superpage_size, superpage_summary, facet_key, ids.  '
+                  . 'The superpage_summary value is a hashref that includes keys: estimated_hit_count, visible.',
+            type => 'object',
+        }
+    }
+);
 __PACKAGE__->register_method(
-	method		=> 'staged_search',
-	api_name	=> 'open-ils.search.biblio.multiclass.staged.staff',
-	signature	=> q/@see open-ils.search.biblio.multiclass.staged/);
+    method    => 'staged_search',
+    api_name  => 'open-ils.search.biblio.multiclass.staged.staff',
+    signature => q/The .staff search includes hidden bibs, hidden items and bibs with no items.  Otherwise, @see open-ils.search.biblio.multiclass.staged/
+);
 __PACKAGE__->register_method(
-	method		=> 'staged_search',
-	api_name	=> 'open-ils.search.metabib.multiclass.staged',
-	signature	=> q/@see open-ils.search.biblio.multiclass.staged/);
+    method    => 'staged_search',
+    api_name  => 'open-ils.search.metabib.multiclass.staged',
+    signature => q/@see open-ils.search.biblio.multiclass.staged/
+);
 __PACKAGE__->register_method(
-	method		=> 'staged_search',
-	api_name	=> 'open-ils.search.metabib.multiclass.staged.staff',
-	signature	=> q/@see open-ils.search.biblio.multiclass.staged/);
+    method    => 'staged_search',
+    api_name  => 'open-ils.search.metabib.multiclass.staged.staff',
+    signature => q/The .staff search includes hidden bibs, hidden items and bibs with no items.  Otherwise, @see open-ils.search.biblio.multiclass.staged/
+);
 
 sub staged_search {
 	my($self, $conn, $search_hash, $docache) = @_;
@@ -918,10 +1005,10 @@
         scalar( keys %{$search_hash->{searches}} ));
 
     my $search_duration;
-    my $user_offset = $search_hash->{offset} || 0; # user-specified offset
-    my $user_limit = $search_hash->{limit} || 10;
-    $user_offset = ($user_offset >= 0) ? $user_offset : 0;
-    $user_limit = ($user_limit >= 0) ? $user_limit : 10;
+    my $user_offset = $search_hash->{offset} ||  0; # user-specified offset
+    my $user_limit  = $search_hash->{limit}  || 10;
+    $user_offset = ($user_offset >= 0) ? $user_offset :  0;
+    $user_limit  = ($user_limit  >= 0) ? $user_limit  : 10;
 
 
     # we're grabbing results on a per-superpage basis, which means the 
@@ -932,7 +1019,7 @@
     # force a well-known check_limit
     $search_hash->{check_limit} = $superpage_size; 
     # restrict total tested to superpage size * number of superpages
-    $search_hash->{core_limit} = $superpage_size * $max_superpages;
+    $search_hash->{core_limit}  = $superpage_size * $max_superpages;
 
     # Set the configured estimation strategy, defaults to 'inclusion'.
 	my $estimation_strategy = OpenSRF::Utils::SettingsClient
@@ -1019,10 +1106,9 @@
             $summary->{estimated_hit_count}." : visible=".$summary->{visible}.", checked=".$summary->{checked});
 
 		if (defined($summary->{estimated_hit_count})) {
-			$global_summary->{checked} += $summary->{checked};
-			$global_summary->{visible} += $summary->{visible};
-			$global_summary->{excluded} += $summary->{excluded};
-			$global_summary->{deleted} += $summary->{deleted};
+            foreach (qw/ checked visible excluded deleted /) {
+                $global_summary->{$_} += $summary->{$_};
+            }
 			$global_summary->{total} = $summary->{total};
 		}
 
@@ -1061,14 +1147,16 @@
 		}
 	}
 
-    $conn->respond_complete({
-        count => $est_hit_count,
-        core_limit => $search_hash->{core_limit},
-        superpage_size => $search_hash->{check_limit},
-        superpage_summary => $current_page_summary,
-        facet_key => $facet_key,
-        ids => \@results
-    });
+    $conn->respond_complete(
+        {
+            count             => $est_hit_count,
+            core_limit        => $search_hash->{core_limit},
+            superpage_size    => $search_hash->{check_limit},
+            superpage_summary => $current_page_summary,
+            facet_key         => $facet_key,
+            ids               => \@results
+        }
+    );
 
     cache_facets($facet_key, $new_ids) if $docache;
     return undef;
@@ -1081,26 +1169,27 @@
 	my @sorted;
     for my $key (sort keys %$search_hash) {
 	    push(@sorted, ($key => $$search_hash{$key})) 
-            unless $key eq 'limit' or 
-                $key eq 'offset' or 
-                $key eq 'skip_check';
+            unless $key eq 'limit'  or 
+                   $key eq 'offset' or 
+                   $key eq 'skip_check';
     }
 	my $s = OpenSRF::Utils::JSON->perl2JSON(\@sorted);
 	return $pfx . md5_hex($method . $s);
 }
 
 sub retrieve_cached_facets {
-    my $self = shift;
+    my $self   = shift;
     my $client = shift;
-    my $key = shift;
+    my $key    = shift;
 
-    return undef unless ($key =~ /_facets$/);
+    return undef unless ($key and $key =~ /_facets$/);
 
     return $cache->get_cache($key) || {};
 }
+
 __PACKAGE__->register_method(
-	method	=> "retrieve_cached_facets",
-	api_name=> "open-ils.search.facet_cache.retrieve"
+    method   => "retrieve_cached_facets",
+    api_name => "open-ils.search.facet_cache.retrieve"
 );
 
 
@@ -1209,17 +1298,14 @@
 }
 
 
-
-
-
-
 __PACKAGE__->register_method(
-	method	=> "biblio_mrid_to_modsbatch_batch",
-	api_name	=> "open-ils.search.biblio.metarecord.mods_slim.batch.retrieve");
+    method   => "biblio_mrid_to_modsbatch_batch",
+    api_name => "open-ils.search.biblio.metarecord.mods_slim.batch.retrieve"
+);
 
 sub biblio_mrid_to_modsbatch_batch {
 	my( $self, $client, $mrids) = @_;
-	warn "Performing mrid_to_modsbatch_batch...";
+	# warn "Performing mrid_to_modsbatch_batch..."; # unconditional warn
 	my @mods;
 	my $method = $self->method_lookup("open-ils.search.biblio.metarecord.mods_slim.retrieve");
 	for my $id (@$mrids) {
@@ -1231,40 +1317,44 @@
 }
 
 
-__PACKAGE__->register_method(
-	method	=> "biblio_mrid_to_modsbatch",
-	api_name	=> "open-ils.search.biblio.metarecord.mods_slim.retrieve",
-	notes		=> <<"	NOTES");
-	Returns the mvr associated with a given metarecod. If none exists, 
-	it is created.
-	NOTES
+foreach (qw /open-ils.search.biblio.metarecord.mods_slim.retrieve
+             open-ils.search.biblio.metarecord.mods_slim.retrieve.staff/)
+    {
+    __PACKAGE__->register_method(
+        method    => "biblio_mrid_to_modsbatch",
+        api_name  => $_,
+        signature => {
+            desc   => "Returns the mvr associated with a given metarecod. If none exists, it is created.  "
+                    . "As usual, the .staff version of this method will include otherwise hidden records.",
+            params => [
+                { desc => 'Metarecord ID', type => 'number' },
+                { desc => '(Optional) Search filters hash with possible keys: format, org, depth', type => 'object' }
+            ],
+            return => {
+                desc => 'MVR Object, event on error',
+            }
+        }
+    );
+}
 
-__PACKAGE__->register_method(
-	method	=> "biblio_mrid_to_modsbatch",
-	api_name	=> "open-ils.search.biblio.metarecord.mods_slim.retrieve.staff",
-	notes		=> <<"	NOTES");
-	Returns the mvr associated with a given metarecod. If none exists, 
-	it is created.
-	NOTES
-
 sub biblio_mrid_to_modsbatch {
 	my( $self, $client, $mrid, $args) = @_;
 
-	warn "Grabbing mvr for $mrid\n";
+	# warn "Grabbing mvr for $mrid\n";    # unconditional warn
 
 	my ($mr, $evt) = _grab_metarecord($mrid);
 	return $evt unless $mr;
 
-	my $mvr = biblio_mrid_check_mvr($self, $client, $mr);
-	$mvr = biblio_mrid_make_modsbatch( $self, $client, $mr ) unless $mvr;
+	my $mvr = biblio_mrid_check_mvr($self, $client, $mr) ||
+              biblio_mrid_make_modsbatch($self, $client, $mr);
 
 	return $mvr unless ref($args);	
 
 	# Here we find the lead record appropriate for the given filters 
 	# and use that for the title and author of the metarecord
-	my $format	= $$args{format};
-	my $org		= $$args{org};
-	my $depth	= $$args{depth};
+    my $format = $$args{format};
+    my $org    = $$args{org};
+    my $depth  = $$args{depth};
 
 	return $mvr unless $format or $org or $depth;
 
@@ -1275,8 +1365,8 @@
 
 	if( my $mods = $U->record_to_mvr($rec) ) {
 
-		$mvr->title($mods->title);
-		$mvr->title($mods->author);
+        $mvr->title( $mods->title );
+        $mvr->author($mods->author);
 		$logger->debug("mods_slim updating title and ".
 			"author in mvr with ".$mods->title." : ".$mods->author);
 	}
@@ -1294,12 +1384,11 @@
 # checks to see if a metarecord has mods, if so returns true;
 
 __PACKAGE__->register_method(
-	method	=> "biblio_mrid_check_mvr",
-	api_name	=> "open-ils.search.biblio.metarecord.mods_slim.check",
-	notes		=> <<"	NOTES");
-	Takes a metarecord ID or a metarecord object and returns true
-	if the metarecord already has an mvr associated with it.
-	NOTES
+    method   => "biblio_mrid_check_mvr",
+    api_name => "open-ils.search.biblio.metarecord.mods_slim.check",
+    notes    => "Takes a metarecord ID or a metarecord object and returns true "
+              . "if the metarecord already has an mvr associated with it."
+);
 
 sub biblio_mrid_check_mvr {
 	my( $self, $client, $mrid ) = @_;
@@ -1310,7 +1399,7 @@
 	else { ($mr, $evt) = _grab_metarecord($mrid); }
 	return $evt if $evt;
 
-	warn "Checking mvr for mr " . $mr->id . "\n";
+	# warn "Checking mvr for mr " . $mr->id . "\n";   # unconditional warn
 
 	return _mr_to_mvr($mr) if $mr->mods();
 	return undef;
@@ -1326,13 +1415,12 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "biblio_mrid_make_modsbatch",
-	api_name	=> "open-ils.search.biblio.metarecord.mods_slim.create",
-	notes		=> <<"	NOTES");
-	Takes either a metarecord ID or a metarecord object.
-	Forces the creations of an mvr for the given metarecord.
-	The created mvr is returned.
-	NOTES
+    method   => "biblio_mrid_make_modsbatch",
+    api_name => "open-ils.search.biblio.metarecord.mods_slim.create",
+    notes    => "Takes either a metarecord ID or a metarecord object. "
+              . "Forces the creations of an mvr for the given metarecord. "
+              . "The created mvr is returned."
+);
 
 sub biblio_mrid_make_modsbatch {
 	my( $self, $client, $mrid ) = @_;
@@ -1401,26 +1489,36 @@
 }
 
 
-
-
 # converts a mr id into a list of record ids
 
-__PACKAGE__->register_method(
-	method	=> "biblio_mrid_to_record_ids",
-	api_name	=> "open-ils.search.biblio.metarecord_to_records",
-);
+foreach (qw/open-ils.search.biblio.metarecord_to_records
+            open-ils.search.biblio.metarecord_to_records.staff/)
+{
+    __PACKAGE__->register_method(
+        method    => "biblio_mrid_to_record_ids",
+        api_name  => $_,
+        signature => {
+            desc   => "Fetch record IDs corresponding to a meta-record ID, with optional search filters. "
+                    . "As usual, the .staff version of this method will include otherwise hidden records.",
+            params => [
+                { desc => 'Metarecord ID', type => 'number' },
+                { desc => '(Optional) Search filters hash with possible keys: format, org, depth', type => 'object' }
+            ],
+            return => {
+                desc => 'Results object like {count => $i, ids =>[...]}',
+                type => 'object'
+            }
+            
+        }
+    );
+}
 
-__PACKAGE__->register_method(
-	method	=> "biblio_mrid_to_record_ids",
-	api_name	=> "open-ils.search.biblio.metarecord_to_records.staff",
-);
-
 sub biblio_mrid_to_record_ids {
 	my( $self, $client, $mrid, $args ) = @_;
 
-	my $format	= $$args{format};
-	my $org		= $$args{org};
-	my $depth	= $$args{depth};
+    my $format = $$args{format};
+    my $org    = $$args{org};
+    my $depth  = $$args{depth};
 
 	my $method = "open-ils.storage.ordered.metabib.metarecord.records.atomic";
 	$method =~ s/atomic/staff\.atomic/o if $self->api_name =~ /staff/o; 
@@ -1431,15 +1529,18 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "biblio_record_to_marc_html",
-	api_name	=> "open-ils.search.biblio.record.html" );
+    method   => "biblio_record_to_marc_html",
+    api_name => "open-ils.search.biblio.record.html"
+);
 
 __PACKAGE__->register_method(
-	method	=> "biblio_record_to_marc_html",
-	api_name	=> "open-ils.search.authority.to_html" );
+    method   => "biblio_record_to_marc_html",
+    api_name => "open-ils.search.authority.to_html"
+);
 
+# Persistent parsers and setting objects
 my $parser = XML::LibXML->new();
-my $xslt = XML::LibXSLT->new();
+my $xslt   = XML::LibXSLT->new();
 my $marc_sheet;
 my $slim_marc_sheet;
 my $settings_client = OpenSRF::Utils::SettingsClient->new();
@@ -1494,8 +1595,9 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_all_copy_statuses",
-	api_name	=> "open-ils.search.config.copy_status.retrieve.all" );
+    method   => "retrieve_all_copy_statuses",
+    api_name => "open-ils.search.config.copy_status.retrieve.all"
+);
 
 sub retrieve_all_copy_statuses {
 	my( $self, $client ) = @_;
@@ -1504,12 +1606,14 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "copy_counts_per_org",
-	api_name	=> "open-ils.search.biblio.copy_counts.retrieve");
+    method   => "copy_counts_per_org",
+    api_name => "open-ils.search.biblio.copy_counts.retrieve"
+);
 
 __PACKAGE__->register_method(
-	method	=> "copy_counts_per_org",
-	api_name	=> "open-ils.search.biblio.copy_counts.retrieve.staff");
+    method   => "copy_counts_per_org",
+    api_name => "open-ils.search.biblio.copy_counts.retrieve.staff"
+);
 
 sub copy_counts_per_org {
 	my( $self, $client, $record_id ) = @_;
@@ -1528,19 +1632,18 @@
 
 
 __PACKAGE__->register_method(
-	method		=> "copy_count_summary",
-	api_name	=> "open-ils.search.biblio.copy_counts.summary.retrieve",
-	notes 		=> <<"	NOTES");
-	returns an array of these:
-		[ org_id, callnumber_label, <status1_count>, <status2_count>,...]
-		where statusx is a copy status name.  the statuses are sorted
-		by id.
-	NOTES
+    method   => "copy_count_summary",
+    api_name => "open-ils.search.biblio.copy_counts.summary.retrieve",
+    notes    => "returns an array of these: "
+              . "[ org_id, callnumber_label, <status1_count>, <status2_count>,...] "
+              . "where statusx is a copy status name.  The statuses are sorted by ID.",
+);
+		
 
 sub copy_count_summary {
 	my( $self, $client, $rid, $org, $depth ) = @_;
-	$org ||= 1;
-	$depth ||= 0;
+    $org   ||= 1;
+    $depth ||= 0;
     my $data = $U->storagereq(
 		'open-ils.storage.biblio.record_entry.status_copy_count.atomic', $rid, $org, $depth );
 
@@ -1548,19 +1651,17 @@
 }
 
 __PACKAGE__->register_method(
-	method		=> "copy_location_count_summary",
-	api_name	=> "open-ils.search.biblio.copy_location_counts.summary.retrieve",
-	notes 		=> <<"	NOTES");
-	returns an array of these:
-		[ org_id, callnumber_label, copy_location, <status1_count>, <status2_count>,...]
-		where statusx is a copy status name.  the statuses are sorted
-		by id.
-	NOTES
+    method   => "copy_location_count_summary",
+    api_name => "open-ils.search.biblio.copy_location_counts.summary.retrieve",
+    notes    => "returns an array of these: "
+              . "[ org_id, callnumber_label, copy_location, <status1_count>, <status2_count>,...] "
+              . "where statusx is a copy status name.  The statuses are sorted by ID.",
+);
 
 sub copy_location_count_summary {
-	my( $self, $client, $rid, $org, $depth ) = @_;
-	$org ||= 1;
-	$depth ||= 0;
+    my( $self, $client, $rid, $org, $depth ) = @_;
+    $org   ||= 1;
+    $depth ||= 0;
     my $data = $U->storagereq(
 		'open-ils.storage.biblio.record_entry.status_copy_location_count.atomic', $rid, $org, $depth );
 
@@ -1568,19 +1669,17 @@
 }
 
 __PACKAGE__->register_method(
-	method		=> "copy_count_location_summary",
-	api_name	=> "open-ils.search.biblio.copy_counts.location.summary.retrieve",
-	notes 		=> <<"	NOTES");
-	returns an array of these:
-		[ org_id, callnumber_label, <status1_count>, <status2_count>,...]
-		where statusx is a copy status name.  the statuses are sorted
-		by id.
-	NOTES
+    method   => "copy_count_location_summary",
+    api_name => "open-ils.search.biblio.copy_counts.location.summary.retrieve",
+    notes    => "returns an array of these: "
+              . "[ org_id, callnumber_label, <status1_count>, <status2_count>,...] "
+              . "where statusx is a copy status name.  The statuses are sorted by ID."
+);
 
 sub copy_count_location_summary {
-	my( $self, $client, $rid, $org, $depth ) = @_;
-	$org ||= 1;
-	$depth ||= 0;
+    my( $self, $client, $rid, $org, $depth ) = @_;
+    $org   ||= 1;
+    $depth ||= 0;
     my $data = $U->storagereq(
         'open-ils.storage.biblio.record_entry.status_copy_location_count.atomic', $rid, $org, $depth );
     return [ sort { $a->[1] cmp $b->[1] } @$data ];
@@ -1588,19 +1687,89 @@
 
 
 __PACKAGE__->register_method(
-	method		=> "marc_search",
-	api_name	=> "open-ils.search.biblio.marc.staff");
+    method   => "marc_search",
+    api_name => "open-ils.search.biblio.marc.staff",
+);
 
 __PACKAGE__->register_method(
-	method		=> "marc_search",
-	api_name	=> "open-ils.search.biblio.marc",
-	notes 		=> <<"	NOTES");
-		Example:
-		open-ils.storage.biblio.full_rec.multi_search.atomic 
-		{ "searches": [{"term":"harry","restrict": [{"tag":245,"subfield":"a"}]}], "org_unit": 1,
-        "limit":5,"sort":"author","item_type":"g"}
-	NOTES
+    method   => "marc_search",
+    api_name => "open-ils.search.biblio.marc",
+    signature => {
+        desc   => 'Fetch biblio IDs based on MARC record criteria',
+        params => [
+            {
+                desc => 'Search hash with possible elements: searches, limit, offset, sort, sort_dir.  (required).  ' .
+                        'See perldoc ' . __PACKAGE__ . ' for more detail.',
+                type => 'object'
+            },
+            {desc => 'limit (optional)',  type => 'number'},
+            {desc => 'offset (optional)', type => 'number'}
+        ],
+        return => {
+            desc => 'Results object like: { "count": $i, "ids": [...] }',
+            type => 'object'
+        }
+    }
+);
 
+=head3 open-ils.search.biblio.marc (arghash, limit, offset)
+
+As elsewhere the arghash is the required argument, and must be a hashref.  The keys are:
+
+    searches: complex query object  (required)
+    org_unit: The org ID to focus the search at
+    depth   : The org depth     
+    limit   : integer search limit      default: 10
+    offset  : integer search offset     default:  0
+    sort    : What field to sort the results on? [ author | title | pubdate ]
+    sort_dir: In what direction do we sort? [ asc | desc ]
+
+Additional keys to refine search criteria:
+
+    audience : Audience
+    language : Language (code)
+    lit_form : Literary form
+    item_form: Item form
+    item_type: Item type
+    format   : The MARC format
+
+Please note that the specific strings to be used in the "addtional keys" will be entirely
+dependent on your loaded data.  
+
+All keys except "searches" are optional.
+The "searches" value must be an arrayref of hashref elements, including keys "term" and "restrict".  
+
+For example, an arg hash might look like:
+
+    $arghash = {
+        searches => [
+            {
+                term     => "harry",
+                restrict => [
+                    {
+                        tag => 245,
+                        subfield => "a"
+                    }
+                    # ...
+                ]
+            }
+            # ...
+        ],
+        org_unit  => 1,
+        limit     => 5,
+        sort      => "author",
+        item_type => "g"
+    }
+
+The arghash is eventually passed to the SRF call:
+L<open-ils.storage.biblio.full_rec.multi_search[.staff].atomic>
+
+Presently, search uses the cache unconditionally.
+
+=cut
+
+# FIXME: that example above isn't actually tested.
+# TODO: docache option?
 sub marc_search {
 	my( $self, $conn, $args, $limit, $offset ) = @_;
 
@@ -1608,8 +1777,8 @@
 	$method .= ".staff" if $self->api_name =~ /staff/;
 	$method .= ".atomic";
 
-	$limit ||= 10;
-	$offset ||= 0;
+    $limit  ||= 10;     # FIXME: what about $args->{limit} ?
+    $offset ||=  0;     # FIXME: what about $args->{offset} ?
 
 	my @search;
 	push( @search, ($_ => $$args{$_}) ) for (sort keys %$args);
@@ -1636,22 +1805,30 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "biblio_search_isbn",
-	api_name	=> "open-ils.search.biblio.isbn",
+    method    => "biblio_search_isbn",
+    api_name  => "open-ils.search.biblio.isbn",
+    signature => {
+        desc   => 'Retrieve biblio IDs for a given ISBN',
+        params => [
+            {desc => 'ISBN', type => 'string'}  # or number maybe?  How normalized is our storage data?
+        ],
+        return => {
+            desc => 'Results object like: { "count": $i, "ids": [...] }',
+            type => 'object'
+        }
+    }
 );
 
 sub biblio_search_isbn { 
 	my( $self, $client, $isbn ) = @_;
 	$logger->debug("Searching ISBN $isbn");
-	my $e = new_editor();
-	my $recs = $U->storagereq(
-		'open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $isbn );
+	my $recs = $U->storagereq('open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $isbn);
 	return { ids => $recs, count => scalar(@$recs) };
 }
 
 __PACKAGE__->register_method(
-	method	=> "biblio_search_isbn_batch",
-	api_name	=> "open-ils.search.biblio.isbn_list",
+    method   => "biblio_search_isbn_batch",
+    api_name => "open-ils.search.biblio.isbn_list",
 );
 
 sub biblio_search_isbn_batch { 
@@ -1672,8 +1849,18 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "biblio_search_issn",
-	api_name	=> "open-ils.search.biblio.issn",
+    method   => "biblio_search_issn",
+    api_name => "open-ils.search.biblio.issn",
+    signature => {
+        desc   => 'Retrieve biblio IDs for a given ISSN',
+        params => [
+            {desc => 'ISBN', type => 'string'}
+        ],
+        return => {
+            desc => 'Results object like: { "count": $i, "ids": [...] }',
+            type => 'object'
+        }
+    }
 );
 
 sub biblio_search_issn { 
@@ -1687,11 +1874,9 @@
 }
 
 
-
-
 __PACKAGE__->register_method(
-	method	=> "fetch_mods_by_copy",
-	api_name	=> "open-ils.search.biblio.mods_from_copy",
+    method   => "fetch_mods_by_copy",
+    api_name => "open-ils.search.biblio.mods_from_copy",
 );
 
 sub fetch_mods_by_copy {
@@ -1707,22 +1892,22 @@
 # -------------------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse",
-	api_name	=> "open-ils.search.callnumber.browse.target",
-	notes		=> "Starts a callnumber browse"
-	);
+    method   => "cn_browse",
+    api_name => "open-ils.search.callnumber.browse.target",
+    notes    => "Starts a callnumber browse"
+);
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse",
-	api_name	=> "open-ils.search.callnumber.browse.page_up",
-	notes		=> "Returns the previous page of callnumbers", 
-	);
+    method   => "cn_browse",
+    api_name => "open-ils.search.callnumber.browse.page_up",
+    notes    => "Returns the previous page of callnumbers",
+);
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse",
-	api_name	=> "open-ils.search.callnumber.browse.page_down",
-	notes		=> "Returns the next page of callnumbers", 
-	);
+    method   => "cn_browse",
+    api_name => "open-ils.search.callnumber.browse.page_down",
+    notes    => "Returns the next page of callnumbers",
+);
 
 
 # RETURNS array of arrays like so: label, owning_lib, record, id
@@ -1742,11 +1927,11 @@
 # -------------------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => "fetch_cn",
+    method        => "fetch_cn",
+    api_name      => "open-ils.search.callnumber.retrieve",
     authoritative => 1,
-	api_name => "open-ils.search.callnumber.retrieve",
-	notes		=> "retrieves a callnumber based on ID",
-	);
+    notes         => "retrieves a callnumber based on ID",
+);
 
 sub fetch_cn {
 	my( $self, $client, $id ) = @_;
@@ -1755,13 +1940,13 @@
 	return $cn;
 }
 
-__PACKAGE__->register_method (
-	method		=> "fetch_copy_by_cn",
-	api_name		=> 'open-ils.search.copies_by_call_number.retrieve',
-	signature	=> q/
-		Returns an array of copy id's by callnumber id
-		@param cnid The callnumber id
-		@return An array of copy ids
+__PACKAGE__->register_method(
+    method    => "fetch_copy_by_cn",
+    api_name  => 'open-ils.search.copies_by_call_number.retrieve',
+    signature => q/
+		Returns an array of copy ID's by callnumber ID
+		@param cnid The callnumber ID
+		@return An array of copy IDs
 	/
 );
 
@@ -1772,10 +1957,10 @@
 		{ call_number => $cnid, deleted => 'f' } );
 }
 
-__PACKAGE__->register_method (
-	method		=> 'fetch_cn_by_info',
-	api_name		=> 'open-ils.search.call_number.retrieve_by_info',
-	signature	=> q/
+__PACKAGE__->register_method(
+    method    => 'fetch_cn_by_info',
+    api_name  => 'open-ils.search.call_number.retrieve_by_info',
+    signature => q/
 		@param label The callnumber label
 		@param record The record the cn is attached to
 		@param org The owning library of the cn
@@ -1792,25 +1977,28 @@
 }
 
 
-		
 
+__PACKAGE__->register_method(
+    method   => 'bib_extras',
+    api_name => 'open-ils.search.biblio.lit_form_map.retrieve.all'
+);
+__PACKAGE__->register_method(
+    method   => 'bib_extras',
+    api_name => 'open-ils.search.biblio.item_form_map.retrieve.all'
+);
+__PACKAGE__->register_method(
+    method   => 'bib_extras',
+    api_name => 'open-ils.search.biblio.item_type_map.retrieve.all'
+);
+__PACKAGE__->register_method(
+    method   => 'bib_extras',
+    api_name => 'open-ils.search.biblio.bib_level_map.retrieve.all'
+);
+__PACKAGE__->register_method(
+    method   => 'bib_extras',
+    api_name => 'open-ils.search.biblio.audience_map.retrieve.all'
+);
 
-__PACKAGE__->register_method (
-	method => 'bib_extras',
-	api_name => 'open-ils.search.biblio.lit_form_map.retrieve.all');
-__PACKAGE__->register_method (
-	method => 'bib_extras',
-	api_name => 'open-ils.search.biblio.item_form_map.retrieve.all');
-__PACKAGE__->register_method (
-	method => 'bib_extras',
-	api_name => 'open-ils.search.biblio.item_type_map.retrieve.all');
-__PACKAGE__->register_method (
-	method => 'bib_extras',
-	api_name => 'open-ils.search.biblio.bib_level_map.retrieve.all');
-__PACKAGE__->register_method (
-	method => 'bib_extras',
-	api_name => 'open-ils.search.biblio.audience_map.retrieve.all');
-
 sub bib_extras {
 	my $self = shift;
 
@@ -1837,34 +2025,40 @@
 
 
 __PACKAGE__->register_method(
-	method	=> 'fetch_slim_record',
-	api_name	=> 'open-ils.search.biblio.record_entry.slim.retrieve',
-	signature=> q/
-		Returns a biblio.record_entry without the attached marcxml
-	/
+    method    => 'fetch_slim_record',
+    api_name  => 'open-ils.search.biblio.record_entry.slim.retrieve',
+    signature => {
+        desc   => "Retrieves one or more biblio.record_entry without the attached marcxml",
+        params => [
+            { desc => 'Array of Record IDs', type => 'array' }
+        ],
+        return => { 
+            desc => 'Array of biblio records, event on error'
+        }
+    }
 );
 
 sub fetch_slim_record {
-	my( $self, $conn, $ids ) = @_;
+    my( $self, $conn, $ids ) = @_;
 
-	#my $editor = OpenILS::Utils::Editor->new;
-	my $editor = new_editor();
+#my $editor = OpenILS::Utils::Editor->new;
+    my $editor = new_editor();
 	my @res;
-	for( @$ids ) {
-		return $editor->event unless
-			my $r = $editor->retrieve_biblio_record_entry($_);
-		$r->clear_marc;
-		push(@res, $r);
-	}
-	return \@res;
+    for( @$ids ) {
+        return $editor->event unless
+            my $r = $editor->retrieve_biblio_record_entry($_);
+        $r->clear_marc;
+        push(@res, $r);
+    }
+    return \@res;
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'rec_to_mr_rec_descriptors',
-	api_name	=> 'open-ils.search.metabib.record_to_descriptors',
-	signature	=> q/
+    method    => 'rec_to_mr_rec_descriptors',
+    api_name  => 'open-ils.search.metabib.record_to_descriptors',
+    signature => q/
 		specialized method...
 		Given a biblio record id or a metarecord id, 
 		this returns a list of metabib.record_descriptor
@@ -1876,11 +2070,11 @@
 sub rec_to_mr_rec_descriptors {
 	my( $self, $conn, $args ) = @_;
 
-	my $rec = $$args{record};
-	my $mrec	= $$args{metarecord};
-	my $item_forms = $$args{item_forms};
-	my $item_types	= $$args{item_types};
-	my $item_lang	= $$args{item_lang};
+    my $rec        = $$args{record};
+    my $mrec       = $$args{metarecord};
+    my $item_forms = $$args{item_forms};
+    my $item_types = $$args{item_types};
+    my $item_lang  = $$args{item_lang};
 
 	my $e = new_editor();
 	my $recs;
@@ -1898,7 +2092,7 @@
 	my $search = { record => \@recs };
 	$search->{item_form} = $item_forms if $item_forms and @$item_forms;
 	$search->{item_type} = $item_types if $item_types and @$item_types;
-	$search->{item_lang} = $item_lang if $item_lang;
+	$search->{item_lang} = $item_lang  if $item_lang;
 
 	my $desc = $e->search_metabib_record_descriptor($search);
 
@@ -1907,8 +2101,8 @@
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_age_protect',
-	api_name => 'open-ils.search.copy.age_protect.retrieve.all',
+    method   => 'fetch_age_protect',
+    api_name => 'open-ils.search.copy.age_protect.retrieve.all',
 );
 
 sub fetch_age_protect {
@@ -1917,13 +2111,13 @@
 
 
 __PACKAGE__->register_method(
-	method => 'copies_by_cn_label',
-	api_name => 'open-ils.search.asset.copy.retrieve_by_cn_label',
+    method   => 'copies_by_cn_label',
+    api_name => 'open-ils.search.asset.copy.retrieve_by_cn_label',
 );
 
 __PACKAGE__->register_method(
-	method => 'copies_by_cn_label',
-	api_name => 'open-ils.search.asset.copy.retrieve_by_cn_label.staff',
+    method   => 'copies_by_cn_label',
+    api_name => 'open-ils.search.asset.copy.retrieve_by_cn_label.staff',
 );
 
 sub copies_by_cn_label {
@@ -1949,7 +2143,5 @@
 }
 
 
-
 1;
 
-

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm	2010-03-31 07:43:46 UTC (rev 16067)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm	2010-03-31 13:31:28 UTC (rev 16068)
@@ -415,25 +415,24 @@
 );
 
 sub biblio_multi_search_full_rec {
-	my $self = shift;
-	my $client = shift;
+    my $self   = shift;
+    my $client = shift;
+    my %args   = @_;
 
-	my %args = @_;	
-	my $class_join = $args{class_join} || 'AND';
-	my $limit = $args{limit} || 100;
-	my $offset = $args{offset} || 0;
-	my $sort = $args{'sort'};
-	my $sort_dir = $args{sort_dir} || 'DESC';
+    my $class_join = $args{class_join} || 'AND';
+    my $limit      = $args{limit}      || 100;
+    my $offset     = $args{offset}     || 0;
+    my $sort       = $args{'sort'};
+    my $sort_dir   = $args{sort_dir}   || 'DESC';
 
 	my @binds;
 	my @selects;
 
 	for my $arg (@{ $args{searches} }) {
-		my $term = $$arg{term};
+		my $term     = $$arg{term};
 		my $limiters = $$arg{restrict};
 
-		my ($index_col) = metabib::full_rec->columns('FTS');
-		$index_col ||= 'value';
+		my ($index_col)  = metabib::full_rec->columns('FTS') || 'value';
 		my $search_table = metabib::full_rec->table;
 
 		my $fts = OpenILS::Application::Storage::FTS->compile('default' => $term, 'value',"$index_col");
@@ -480,8 +479,8 @@
 
 	if ($self->api_name =~ /staff/o) {
 		$copies_visible = '';
-		$has_copies = '' if ($ou_type == 0);
-		$has_vols = '' if ($ou_type == 0);
+		$has_copies     = '' if ($ou_type == 0);
+		$has_vols       = '' if ($ou_type == 0);
 	}
 
 	my ($t_filter, $f_filter) = ('','');
@@ -1428,17 +1427,17 @@
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub postfilter_search_multi_class_fts {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
+    my $self   = shift;
+    my $client = shift;
+    my %args   = @_;
 	
-	my $sort = $args{'sort'};
-	my $sort_dir = $args{sort_dir} || 'DESC';
-	my $ou = $args{org_unit};
-	my $ou_type = $args{depth};
-	my $limit = $args{limit} || 10;;
-	my $visibility_limit = $args{visibility_limit} || 5000;;
-	my $offset = $args{offset} || 0;
+    my $sort             = $args{'sort'};
+    my $sort_dir         = $args{sort_dir} || 'DESC';
+    my $ou               = $args{org_unit};
+    my $ou_type          = $args{depth};
+    my $limit            = $args{limit}  || 10;
+    my $offset           = $args{offset} ||  0;
+    my $visibility_limit = $args{visibility_limit} || 5000;
 
 	if (!$ou) {
 		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
@@ -1454,16 +1453,16 @@
 
 	my $outer_limit = 1000;
 
-	my $limit_clause = '';
+	my $limit_clause  = '';
 	my $offset_clause = '';
 
-	$limit_clause = "LIMIT $outer_limit";
+	$limit_clause  = "LIMIT $outer_limit";
 	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
 
 	my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
-	my ($t_filter, $f_filter, $v_filter) = ('','','');
-	my ($a_filter, $l_filter, $lf_filter) = ('','','');
-	my ($ot_filter, $of_filter, $ov_filter) = ('','','');
+	my ($t_filter,   $f_filter,   $v_filter) = ('','','');
+	my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
+	my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
 	my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
 
 	if ($args{available}) {
@@ -1474,7 +1473,7 @@
 		$a = [$a] if (!ref($a));
 		@aud = @$a;
 			
-		$a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
+		$a_filter  = ' AND  rd.audience IN ('.join(',',map{'?'}@aud).')';
 		$oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
 	}
 
@@ -1482,7 +1481,7 @@
 		$l = [$l] if (!ref($l));
 		@lang = @$l;
 
-		$l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
+		$l_filter  = ' AND  rd.item_lang IN ('.join(',',map{'?'}@lang).')';
 		$ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
 	}
 
@@ -1490,7 +1489,7 @@
 		$f = [$f] if (!ref($f));
 		@lit_form = @$f;
 
-		$lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+		$lf_filter  = ' AND  rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
 		$olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
 	}
 
@@ -1498,7 +1497,7 @@
 		$f = [$f] if (!ref($f));
 		@forms = @$f;
 
-		$f_filter = ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+		$f_filter  = ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
 		$of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
 	}
 
@@ -1506,7 +1505,7 @@
 		$t = [$t] if (!ref($t));
 		@types = @$t;
 
-		$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+		$t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
 		$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
 	}
 
@@ -1514,7 +1513,7 @@
 		$v = [$v] if (!ref($v));
 		@vformats = @$v;
 
-		$v_filter = ' AND rd.vr_format IN ('.join(',',map{'?'}@vformats).')';
+		$v_filter  = ' AND  rd.vr_format IN ('.join(',',map{'?'}@vformats).')';
 		$ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
 	}
 
@@ -1525,12 +1524,12 @@
 		@types = split '', $t;
 		@forms = split '', $f;
 		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+			$t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
 			$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
 		}
 
 		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+			$f_filter  .= ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
 			$of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
 		}
 	}
@@ -1541,10 +1540,10 @@
 				"actor.org_unit_descendants($ou, $ou_type)" :
 				"actor.org_unit_descendants($ou)";
 
-	my $search_table_list = '';
-	my $fts_list = '';
-	my $join_table_list = '';
-	my @rank_list;
+    my $search_table_list = '';
+    my $fts_list          = '';
+    my $join_table_list   = '';
+    my @rank_list;
 
 	my $field_table = config::metabib_field->table;
 
@@ -1592,7 +1591,7 @@
 
 		my %bonus = ();
 		$bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value LIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
-		$bonus{'author'} = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $first_word } ];
+		$bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $first_word } ];
 
 		$bonus{'series'} = [
 			{ "CASE WHEN $search_group_name.value LIKE ? THEN 1.5 ELSE 1 END" => $first_word },
@@ -1925,14 +1924,14 @@
 	my $client = shift;
 	my %args = @_;
 	
-	my $sort = $args{'sort'};
-	my $sort_dir = $args{sort_dir} || 'DESC';
-	my $ou = $args{org_unit};
-	my $ou_type = $args{depth};
-	my $limit = $args{limit} || 10;
-	my $pref_lang = $args{prefered_language} || 'eng';
-	my $visibility_limit = $args{visibility_limit} || 5000;
-	my $offset = $args{offset} || 0;
+    my $sort             = $args{'sort'};
+    my $sort_dir         = $args{sort_dir} || 'DESC';
+    my $ou               = $args{org_unit};
+    my $ou_type          = $args{depth};
+    my $limit            = $args{limit}  || 10;
+    my $offset           = $args{offset} ||  0;
+    my $pref_lang        = $args{prefered_language} || 'eng';
+    my $visibility_limit = $args{visibility_limit}  || 5000;
 
 	if (!$ou) {
 		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
@@ -1944,16 +1943,16 @@
 
 	my $outer_limit = 1000;
 
-	my $limit_clause = '';
+	my $limit_clause  = '';
 	my $offset_clause = '';
 
-	$limit_clause = "LIMIT $outer_limit";
+	$limit_clause  = "LIMIT $outer_limit";
 	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
 
 	my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
-	my ($t_filter, $f_filter, $v_filter) = ('','','');
-	my ($a_filter, $l_filter, $lf_filter) = ('','','');
-	my ($ot_filter, $of_filter, $ov_filter) = ('','','');
+	my ($t_filter,   $f_filter,   $v_filter) = ('','','');
+	my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
+	my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
 	my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
 
 	if ($args{available}) {
@@ -1964,7 +1963,7 @@
 		$a = [$a] if (!ref($a));
 		@aud = @$a;
 			
-		$a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
+		$a_filter  = ' AND rd.audience  IN ('.join(',',map{'?'}@aud).')';
 		$oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
 	}
 
@@ -1972,7 +1971,7 @@
 		$l = [$l] if (!ref($l));
 		@lang = @$l;
 
-		$l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
+		$l_filter  = ' AND rd.item_lang  IN ('.join(',',map{'?'}@lang).')';
 		$ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
 	}
 
@@ -1980,7 +1979,7 @@
 		$f = [$f] if (!ref($f));
 		@lit_form = @$f;
 
-		$lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+		$lf_filter  = ' AND rd.lit_form  IN ('.join(',',map{'?'}@lit_form).')';
 		$olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
 	}
 
@@ -1988,7 +1987,7 @@
 		$f = [$f] if (!ref($f));
 		@forms = @$f;
 
-		$f_filter = ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+		$f_filter  = ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
 		$of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
 	}
 
@@ -1996,7 +1995,7 @@
 		$t = [$t] if (!ref($t));
 		@types = @$t;
 
-		$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+		$t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
 		$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
 	}
 
@@ -2004,7 +2003,7 @@
 		$v = [$v] if (!ref($v));
 		@vformats = @$v;
 
-		$v_filter = ' AND rd.vr_format IN ('.join(',',map{'?'}@vformats).')';
+		$v_filter  = ' AND rd.vr_format  IN ('.join(',',map{'?'}@vformats).')';
 		$ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
 	}
 
@@ -2014,12 +2013,12 @@
 		@types = split '', $t;
 		@forms = split '', $f;
 		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+			$t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
 			$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
 		}
 
 		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+			$f_filter  .= ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
 			$of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
 		}
 	}
@@ -2080,7 +2079,7 @@
 
 		my %bonus = ();
 		$bonus{'subject'} = [];
-		$bonus{'author'} = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word } ];
+		$bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word } ];
 
 		$bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
 
@@ -2092,11 +2091,11 @@
 		$bonus{'title'} = [ @{ $bonus{'series'} }, @{ $bonus{'keyword'} } ];
 
 		if ($pref_lang) {
-			push @{ $bonus{'title'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'author'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+			push @{ $bonus{'title'}   }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+			push @{ $bonus{'author'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
 			push @{ $bonus{'subject'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
 			push @{ $bonus{'keyword'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'series'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+			push @{ $bonus{'series'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
 		}
 
 		my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$search_class} };
@@ -2310,9 +2309,6 @@
 	stream		=> 1,
 	cachable	=> 1,
 );
-
-
-
 __PACKAGE__->register_method(
 	api_name	=> "open-ils.storage.biblio.multiclass.search_fts",
 	method		=> 'biblio_search_multi_class_fts',
@@ -2335,9 +2331,9 @@
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub staged_fts {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
+    my $self   = shift;
+    my $client = shift;
+    my %args   = @_;
 
     if (!$locale_map{COMPLETE}) {
 
@@ -2372,9 +2368,9 @@
     # inclusion, exclusion, delete_adjusted_inclusion, delete_adjusted_exclusion
     my $estimation_strategy = $args{estimation_strategy} || 'inclusion';
 
-	my $ou = $args{org_unit};
-	my $limit = $args{limit} || 10;
-	my $offset = $args{offset} || 0;
+    my $ou     = $args{org_unit};
+    my $limit  = $args{limit}  || 10;
+    my $offset = $args{offset} ||  0;
 
 	if (!$ou) {
 		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
@@ -2485,10 +2481,10 @@
         );
 		$fts->sql_where_clause; # this builds the ranks for us
 
-		my @fts_ranks = $fts->fts_rank;
+		my @fts_ranks   = $fts->fts_rank;
 		my @fts_queries = $fts->fts_query;
 		my @phrases = map { lc($_) } $fts->phrases;
-		my @words = map { lc($_) } $fts->words;
+		my @words   = map { lc($_) } $fts->words;
 
         $stored_proc_search_args{$search_group} = {
             fts_rank    => \@fts_ranks,
@@ -2502,17 +2498,17 @@
 	my $param_search_ou = $ou;
 	my $param_depth = $args{depth}; $param_depth = 'NULL' unless (defined($param_depth) and length($param_depth) > 0 );
 	my $param_searches = OpenSRF::Utils::JSON->perl2JSON( \%stored_proc_search_args ); $param_searches =~ s/\$//go; $param_searches = '$$'.$param_searches.'$$';
-	my $param_statuses = '$${' . join(',', map { s/\$//go; "\"$_\""} @statuses) . '}$$';
-	my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\""} @locations) . '}$$';
-	my $param_audience = '$${' . join(',', map { s/\$//go; "\"$_\"" } @aud) . '}$$';
-	my $param_language = '$${' . join(',', map { s/\$//go; "\"$_\""} @lang) . '}$$';
-	my $param_lit_form = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lit_form) . '}$$';
-	my $param_types = '$${' . join(',', map { s/\$//go; "\"$_\""} @types) . '}$$';
-	my $param_forms = '$${' . join(',', map { s/\$//go; "\"$_\""} @forms) . '}$$';
-	my $param_vformats = '$${' . join(',', map { s/\$//go; "\"$_\"" } @vformats) . '}$$';
+	my $param_statuses  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @statuses ) . '}$$';
+	my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\"" } @locations) . '}$$';
+	my $param_audience  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @aud      ) . '}$$';
+	my $param_language  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lang     ) . '}$$';
+	my $param_lit_form  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lit_form ) . '}$$';
+	my $param_types     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @types    ) . '}$$';
+	my $param_forms     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @forms    ) . '}$$';
+	my $param_vformats  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @vformats ) . '}$$';
     my $param_bib_level = '$${' . join(',', map { s/\$//go; "\"$_\"" } @bib_level) . '}$$';
 	my $param_before = $args{before}; $param_before = 'NULL' unless (defined($param_before) and length($param_before) > 0 );
-	my $param_after = $args{after}; $param_after = 'NULL' unless (defined($param_after) and length($param_after) > 0 );
+	my $param_after  = $args{after} ; $param_after  = 'NULL' unless (defined($param_after ) and length($param_after ) > 0 );
 	my $param_during = $args{during}; $param_during = 'NULL' unless (defined($param_during) and length($param_during) > 0 );
     my $param_between = '$${"' . join('","', map { int($_) } @between) . '"}$$';
 	my $param_pref_lang = $args{preferred_language}; $param_pref_lang =~ s/\$//go; $param_pref_lang = '$$'.$param_pref_lang.'$$';
@@ -2521,9 +2517,9 @@
 	my $param_sort_desc = defined($args{sort_dir}) && $args{sort_dir} =~ /^d/io ? "'t'" : "'f'";
 	my $metarecord = $self->api_name =~ /metabib/o ? "'t'" : "'f'";
 	my $staff = $self->api_name =~ /staff/o ? "'t'" : "'f'";
-    my $param_rel_limit = $args{core_limit}; $param_rel_limit ||= 'NULL';
+    my $param_rel_limit = $args{core_limit};  $param_rel_limit ||= 'NULL';
     my $param_chk_limit = $args{check_limit}; $param_chk_limit ||= 'NULL';
-    my $param_skip_chk = $args{skip_check}; $param_skip_chk ||= 'NULL';
+    my $param_skip_chk  = $args{skip_check};  $param_skip_chk  ||= 'NULL';
 
 	my $sth = metabib::metarecord_source_map->db_Main->prepare(<<"    SQL");
         SELECT  *
@@ -2561,10 +2557,10 @@
     my $recs = $sth->fetchall_arrayref({});
     my $summary_row = pop @$recs;
 
-    my $total = $$summary_row{total};
-    my $checked = $$summary_row{checked};
-    my $visible = $$summary_row{visible};
-    my $deleted = $$summary_row{deleted};
+    my $total    = $$summary_row{total};
+    my $checked  = $$summary_row{checked};
+    my $visible  = $$summary_row{visible};
+    my $deleted  = $$summary_row{deleted};
     my $excluded = $$summary_row{excluded};
 
     my $estimate = $visible;
@@ -2625,14 +2621,14 @@
 );
 
 sub FTS_paging_estimate {
-	my $self = shift;
-	my $client = shift;
+    my $self   = shift;
+    my $client = shift;
 
-    my $checked = shift;
-    my $visible = shift;
+    my $checked  = shift;
+    my $visible  = shift;
     my $excluded = shift;
-    my $deleted = shift;
-    my $total = shift;
+    my $deleted  = shift;
+    my $total    = shift;
 
     my $deleted_ratio = $deleted / $checked;
     my $delete_adjusted_total = $total - ( $total * $deleted_ratio );
@@ -2698,13 +2694,13 @@
 
 
 sub xref_count {
-	my $self = shift;
-	my $client = shift;
-	my $args = shift;
+    my $self   = shift;
+    my $client = shift;
+    my $args   = shift;
 
-	my $term = $$args{term};
-	my $limit = $$args{max} || 1;
-	my $min = $$args{min} || 1;
+    my $term  = $$args{term};
+    my $limit = $$args{max} || 1;
+    my $min   = $$args{min} || 1;
 	my @classes = @{$$args{class}};
 
 	$limit = $min if ($min > $limit);
@@ -2715,8 +2711,8 @@
 
 	my %matches;
 	my $bre_table = biblio::record_entry->table;
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
+	my $cn_table  = asset::call_number->table;
+	my $cp_table  = asset::copy->table;
 
 	for my $search_class ( @classes ) {
 
@@ -2750,9 +2746,9 @@
 	return \%matches;
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.search.xref",
-	method		=> 'xref_count',
-	api_level	=> 1,
+    api_name  => "open-ils.storage.search.xref",
+    method    => 'xref_count',
+    api_level => 1,
 );
 
 sub query_parser_fts {
@@ -2981,10 +2977,10 @@
     my $recs = $sth->fetchall_arrayref({});
     my $summary_row = pop @$recs;
 
-    my $total = $$summary_row{total};
-    my $checked = $$summary_row{checked};
-    my $visible = $$summary_row{visible};
-    my $deleted = $$summary_row{deleted};
+    my $total    = $$summary_row{total};
+    my $checked  = $$summary_row{checked};
+    my $visible  = $$summary_row{visible};
+    my $deleted  = $$summary_row{deleted};
     my $excluded = $$summary_row{excluded};
 
     my $estimate = $visible;

Modified: trunk/build/tools/update_db.sh
===================================================================


Property changes on: trunk/build/tools/update_db.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the open-ils-commits mailing list