[open-ils-commits] r19921 - in branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application: Search Storage/Publisher (dbwells)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 31 14:13:07 EDT 2011
Author: dbwells
Date: 2011-03-31 14:13:03 -0400 (Thu, 31 Mar 2011)
New Revision: 19921
Modified:
branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
Log:
Use identifer indexes for older ISxN API methods (LP Bug #728671)
There are three logic layers involved in the older ISxN 'quick searches': the OPAC, the search API, and the storage API. The approach of this patch is to update the search API (which in turn fixes the OPAC), and ignore/deprecate the storage API for these identifiers.
Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm 2011-03-31 18:12:39 UTC (rev 19920)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm 2011-03-31 18:13:03 UTC (rev 19921)
@@ -2083,7 +2083,7 @@
signature => {
desc => 'Retrieve biblio IDs for a given ISBN',
params => [
- {desc => 'ISBN', type => 'string'} # or number maybe? How normalized is our storage data?
+ {desc => 'ISBN', type => 'string'}
],
return => {
desc => 'Results object like: { "count": $i, "ids": [...] }',
@@ -2095,10 +2095,17 @@
sub biblio_search_isbn {
my( $self, $client, $isbn ) = @_;
$logger->debug("Searching ISBN $isbn");
- # Strip hyphens from incoming ISBNs
- $isbn =~ s/-//g;
- my $recs = $U->storagereq('open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $isbn);
- return { ids => $recs, count => scalar(@$recs) };
+ # the previous implementation of this method was essentially unlimited,
+ # so we will set our limit very high and let multiclass.query provide any
+ # actual limit
+ # XXX: if making this unlimited is deemed important, we might consider
+ # reworking 'open-ils.storage.id_list.biblio.record_entry.search.isbn',
+ # which is functionally deprecated at this point, or a custom call to
+ # 'open-ils.storage.biblio.multiclass.search_fts'
+ my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
+ my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
+ my @recs = map { $_->[0] } @{$search_result->{'ids'}};
+ return { ids => \@recs, count => $search_result->{'count'} };
}
__PACKAGE__->register_method(
@@ -2106,16 +2113,16 @@
api_name => "open-ils.search.biblio.isbn_list",
);
+# XXX: see biblio_search_isbn() for note concerning 'limit'
sub biblio_search_isbn_batch {
my( $self, $client, $isbn_list ) = @_;
$logger->debug("Searching ISBNs @$isbn_list");
my @recs = (); my %rec_set = ();
+ my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
foreach my $isbn ( @$isbn_list ) {
- # Strip hyphens from incoming ISBNs
- $isbn =~ s/-//g;
- foreach my $rec ( @{ $U->storagereq(
- 'open-ils.storage.id_list.biblio.record_entry.search.isbn.atomic', $isbn )
- } ) {
+ my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
+ my @recs_subset = map { $_->[0] } @{$search_result->{'ids'}};
+ foreach my $rec (@recs_subset) {
if (! $rec_set{ $rec }) {
$rec_set{ $rec } = 1;
push @recs, $rec;
@@ -2143,11 +2150,17 @@
sub biblio_search_issn {
my( $self, $client, $issn ) = @_;
$logger->debug("Searching ISSN $issn");
- my $e = new_editor();
- $issn =~ s/-/ /g;
- my $recs = $U->storagereq(
- 'open-ils.storage.id_list.biblio.record_entry.search.issn.atomic', $issn );
- return { ids => $recs, count => scalar(@$recs) };
+ # the previous implementation of this method was essentially unlimited,
+ # so we will set our limit very high and let multiclass.query provide any
+ # actual limit
+ # XXX: if making this unlimited is deemed important, we might consider
+ # reworking 'open-ils.storage.id_list.biblio.record_entry.search.issn',
+ # which is functionally deprecated at this point, or a custom call to
+ # 'open-ils.storage.biblio.multiclass.search_fts'
+ my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
+ my ($search_result) = $method->run({'limit' => 1000000}, "identifier|issn:$issn");
+ my @recs = map { $_->[0] } @{$search_result->{'ids'}};
+ return { ids => \@recs, count => $search_result->{'count'} };
}
Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm 2011-03-31 18:12:39 UTC (rev 19920)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm 2011-03-31 18:13:03 UTC (rev 19921)
@@ -215,6 +215,9 @@
cachable => 1,
);
+# XXX: this subroutine and its two registered methods are marked for
+# deprecation, as they do not work properly in 2.x (these tags are no longer
+# normalized in mfr) and are not in known use
sub isxn_search {
my $self = shift;
my $client = shift;
More information about the open-ils-commits
mailing list