eet leevs
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Mar 2005 22:52:21 +0000 (22:52 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Mar 2005 22:52:21 +0000 (22:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@338 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/import/import_clean_marc.pl
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/FTS.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/src/perlmods/OpenILS/Application/WORM.pm
OpenSRF/src/perlmods/OpenSRF/Application.pm

index c44e04f..31e5269 100755 (executable)
@@ -40,6 +40,8 @@ try {
 while ( my $xml = <> ) {
        chomp $xml;
 
+       my $new_id;
+
        my $ns = OpenILS::Utils::FlatXML->new( xml => $xml );
 
        next unless ($ns->xml);
@@ -81,7 +83,7 @@ while ( my $xml = <> ) {
                        throw OpenSRF::EX::ERROR ("Failed to create record for TCN [$tcn].  Got an exception!! -- ".$resp->toString);
                }
 
-               my $new_id = $resp->content;
+               $new_id = $resp->content;
                warn "    (new record_entry id is $new_id)\n";
 
                $req->finish;
@@ -106,13 +108,6 @@ while ( my $xml = <> ) {
                        }
 
 
-                       if ($wormize) {
-                               my $worm_req = $worm_server->request(
-                                       'open-ils.worm.record_data.digest',
-                                       $new_id,
-                               );
-                       }
-
                        $req->finish;
                } else {
                        throw OpenSRF::EX::ERROR ("Failed to create record for TCN [$tcn].  Got no new ID !! -- ".$resp->toString);
@@ -137,6 +132,10 @@ while ( my $xml = <> ) {
                die $r unless (UNIVERSAL::can($r, 'content'));
                die "Couldn't commit transaction!" unless ($r->content);
 
+               if ($wormize) {
+                       $worm_server->request( 'open-ils.worm.wormize', $new_id,);
+               }
+
        }
 }
 
index 1178979..5da85c9 100644 (file)
@@ -77,7 +77,8 @@ sub fast_fieldmapper {
        my $class = ref($self) || $self;
        my $fm_class = 'Fieldmapper::'.$class;
        my @fms;
-       for my $hash ($self->fast_flesh_sth(@_)->fetchall_hash) {
+       $log->debug("fast_fieldmapper() ==> Retrieving $fm_class", INTERNAL);
+       for my $hash ($self->fast_flesh_sth(map {"$_"} @_)->fetchall_hash) {
                my $fm = $fm_class->new;
                for my $field ( keys %$hash ) {
                        $fm->$field( $$hash{$field} );
@@ -122,6 +123,8 @@ sub create {
        my $self = shift;
        my $arg = shift;
 
+       $log->debug("\$arg is $arg (".ref($arg).")",DEBUG);
+
        if (ref($arg) and UNIVERSAL::isa($arg => 'Fieldmapper')) {
                return $self->create_from_fieldmapper($arg,@_);
        }
@@ -134,6 +137,8 @@ sub create_from_fieldmapper {
        my $fm = shift;
        my @params = @_;
 
+       $log->debug("Creating node of type ".ref($fm), DEBUG);
+
        my $class = ref($obj) || $obj;
 
        if (ref $fm) {
@@ -293,6 +298,8 @@ sub import {
        #-------------------------------------------------------------------------------
        
        #-------------------------------------------------------------------------------
+       metabib::full_rec->has_a( record => 'biblio::record_entry' );
+       #-------------------------------------------------------------------------------
        metabib::metarecord->has_a( master_record => 'biblio::record_entry' );
        metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source_record'] );
        #-------------------------------------------------------------------------------
@@ -316,15 +323,19 @@ sub import {
        # should we have just one field entry per class for each record???? (xslt vs xpath)
        metabib::title_field_entry_source_map->has_a( field_entry => 'metabib::title_field_entry' );
        metabib::title_field_entry_source_map->has_a( source_record => 'biblio::record_entry' );
+       metabib::title_field_entry_source_map->has_a( metarecord => 'metabib::metarecord' );
        #-------------------------------------------------------------------------------
        metabib::subject_field_entry_source_map->has_a( field_entry => 'metabib::subject_field_entry' );
        metabib::subject_field_entry_source_map->has_a( source_record => 'biblio::record_entry' );
+       metabib::subject_field_entry_source_map->has_a( metarecord => 'metabib::metarecord' );
        #-------------------------------------------------------------------------------
        metabib::author_field_entry_source_map->has_a( field_entry => 'metabib::author_field_entry' );
        metabib::author_field_entry_source_map->has_a( source_record => 'biblio::record_entry' );
+       metabib::author_field_entry_source_map->has_a( metarecord => 'metabib::metarecord' );
        #-------------------------------------------------------------------------------
        metabib::keyword_field_entry_source_map->has_a( field_entry => 'metabib::keyword_field_entry' );
        metabib::keyword_field_entry_source_map->has_a( source_record => 'biblio::record_entry' );
+       metabib::keyword_field_entry_source_map->has_a( metarecord => 'metabib::metarecord' );
        #-------------------------------------------------------------------------------
        $VERSION = 1;
 }
index 7c9ccc3..fe21111 100644 (file)
@@ -47,7 +47,7 @@ package biblio::record_marc;
 use base qw/biblio/;
 
 biblio::record_marc->table( 'biblio_record_marc' );
-biblio::record_marc->columns( All => qw/id marc/ );
+biblio::record_marc->columns( All => qw/id marc last_xact_id/ );
 #biblio::record_marc->columns( Stringify => qw/marc/ );
 #biblio::record_marc->is_a( id => qw/biblio::record_entry/ );
 
index 3fae55a..e6e1869 100644 (file)
@@ -52,42 +52,40 @@ package metabib::title_field_entry_source_map;
 use base qw/metabib/;
 
 metabib::title_field_entry_source_map->table( 'metabib_title_field_entry_source_map' );
-metabib::title_field_entry_source_map->columns( Primary => qw/field_entry source_record/ );
+metabib::title_field_entry_source_map->columns( Primary => qw/id/ );
+metabib::title_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
 
 #-------------------------------------------------------------------------------
 package metabib::author_field_entry_source_map;
 use base qw/metabib/;
 
 metabib::author_field_entry_source_map->table( 'metabib_author_field_entry_source_map' );
-metabib::author_field_entry_source_map->columns( Primary => qw/field_entry source_record/ );
+metabib::author_field_entry_source_map->columns( Primary => qw/id/ );
+metabib::author_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
 
 #-------------------------------------------------------------------------------
 package metabib::subject_field_entry_source_map;
 use base qw/metabib/;
 
 metabib::subject_field_entry_source_map->table( 'metabib_subject_field_entry_source_map' );
-metabib::subject_field_entry_source_map->columns( Primary => qw/field_entry source_record/ );
+metabib::subject_field_entry_source_map->columns( Primary => qw/id/ );
+metabib::subject_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
 
 #-------------------------------------------------------------------------------
 package metabib::keyword_field_entry_source_map;
 use base qw/metabib/;
 
 metabib::keyword_field_entry_source_map->table( 'metabib_keyword_field_entry_source_map' );
-metabib::keyword_field_entry_source_map->columns( Primary => qw/field_entry source_record/ );
+metabib::keyword_field_entry_source_map->columns( Primary => qw/id/ );
+metabib::keyword_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
 
 #-------------------------------------------------------------------------------
 package metabib::metarecord_source_map;
 use base qw/metabib/;
 
 metabib::metarecord_source_map->table( 'metabib_metarecord_source_map' );
-metabib::metarecord_source_map->columns( Primary => qw/metarecord source_record/ );
-
-#-------------------------------------------------------------------------------
-package metabib::isource_metarecord_map;
-use base qw/metabib/;
-
-metabib::metarecord_source_map->table( 'metabib_metarecord_source_map' );
-metabib::metarecord_source_map->columns( Primary => qw/metarecord source_record/ );
+metabib::metarecord_source_map->columns( Primary => qw/id/ );
+metabib::metarecord_source_map->columns( Others => qw/metarecord source_record/ );
 
 #-------------------------------------------------------------------------------
 package metabib::full_rec;
index e5bdf1f..95b88f6 100644 (file)
 
                my $newterm = join('&', $self->words);
 
-               if ($self->nots) {
+               if (@{$self->nots}) {
                        $newterm = '('.$newterm.')&('. join('|', $self->nots) . ')';
                }
 
-               $newterm = OpenILS::Application::Storage->driver->quote($newterm);
+               $log->debug("Compiled term is [$newterm]", DEBUG);
+               $newterm = OpenILS::Application::Storage::Driver::Pg->quote($newterm);
+               $log->debug("Quoted term is [$newterm]", DEBUG);
 
                $self->{fts_query} = ["to_tsquery('default',$newterm)"];
                $self->{fts_query_nots} = [];
 
                return $self;
        }
+
+       sub sql_where_clause {
+               my $self = shift;
+               my $column = shift;
+               my @output;
+       
+               my @ranks;
+               for my $fts ( $self->fts_query ) {
+                       push @output, join(' ', $column, $self->{fts_op}, $fts);
+                       push @ranks, "rank($column, $fts)";
+               }
+               $self->{fts_rank} = \@ranks;
+       
+               return join(' AND ', @output);
+       }
+
 }
 
 
        }
 
        sub quote {
-               return __PACKAGE__->db_Main->quote(@_)
+               my $self = shift;
+               return $self->db_Main->quote(@_)
        }
 
 #      sub tsearch2_trigger {
 
        metabib::title_field_entry->table( 'metabib.title_field_entry' );
        metabib::title_field_entry->sequence( 'metabib.title_field_entry_id_seq' );
+       metabib::title_field_entry->columns( 'FTS' => 'index_vector' );
 
 #      metabib::title_field_entry->add_trigger(
 #              before_create => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
 
        metabib::author_field_entry->table( 'metabib.author_field_entry' );
        metabib::author_field_entry->sequence( 'metabib.author_field_entry_id_seq' );
+       metabib::author_field_entry->columns( 'FTS' => 'index_vector' );
 
        #-------------------------------------------------------------------------------
 
 
        metabib::subject_field_entry->table( 'metabib.subject_field_entry' );
        metabib::subject_field_entry->sequence( 'metabib.subject_field_entry_id_seq' );
+       metabib::subject_field_entry->columns( 'FTS' => 'index_vector' );
 
        #-------------------------------------------------------------------------------
 
 
        metabib::keyword_field_entry->table( 'metabib.keyword_field_entry' );
        metabib::keyword_field_entry->sequence( 'metabib.keyword_field_entry_id_seq' );
+       metabib::keyword_field_entry->columns( 'FTS' => 'index_vector' );
 
        #-------------------------------------------------------------------------------
 
 
        metabib::full_rec->table( 'metabib.full_rec' );
        metabib::full_rec->sequence( 'metabib.full_rec_id_seq' );
+       metabib::full_rec->columns( 'FTS' => 'index_vector' );
 
        #-------------------------------------------------------------------------------
 }
index d9aff0c..d118a33 100644 (file)
@@ -21,11 +21,14 @@ sub decompose {
        $term =~ s/^\s*\b(.+)\b\s*$/$1/o;
        $term =~ s/^(?:an?|the)\b(.*)/$1/o;
 
-       OpenILS::Utils::Logger->debug("Stripped search term string is [$term]",DEBUG);
+       $log->debug("Stripped search term string is [$term]",DEBUG);
 
        my @words = $term =~ /\b((?<!!)\w+)\b/go;
        my @nots = $term =~ /\b(?<=!)(\w+)\b/go;
 
+       $log->debug("Stripped words are[".join(', ',@words)."]",DEBUG);
+       $log->debug("Stripped nots are[".join(', ',@nots)."]",DEBUG);
+
        my @parts;
        while ($term =~ s/ ("+) (.*?) ((?<!\\)"){1} //x) {
                my $part = $2;
@@ -60,6 +63,11 @@ sub fts_query_not {
        return wantarray ? @{ $self->{fts_query_not} } : $self->{fts_query_not};
 }
 
+sub fts_rank {
+       my $self = shift;
+       return wantarray ? @{ $self->{fts_rank} } : $self->{fts_rank};
+}
+
 sub fts_query {
        my $self = shift;
        return wantarray ? @{ $self->{fts_query} } : $self->{fts_query};
index 8b9b9bc..16f2d53 100644 (file)
@@ -50,7 +50,7 @@ sub create_node {
        my $success;
        try {
                my $rec = $cdbi->create($node);
-               $success = 1 if ($rec);
+               $success = $rec->id if ($rec);
        } catch Error with {
                $success = 0;
        };
index 2d4746a..b723fc9 100644 (file)
@@ -21,30 +21,30 @@ sub create_record_entry {
 
        return undef;
 }
-__PACKAGE__->register_method(
-       method          => 'create_record_entry',
-       api_name        => 'open-ils.storage.biblio.record_entry.create',
-       api_level       => 1,
-       argc            => 2,
-       note            => <<TEXT,
-
-Params should be passed as a hash ref! 
-Required fields are:
-
-       creator
-       editor
-
-Please at least try to fill in:
-
-       tcn_source
-       tcn_value
-       metarecord
-       source
-       active
-
-TEXT
-
-);
+#__PACKAGE__->register_method(
+       #method         => 'create_record_entry',
+       #api_name       => 'open-ils.storage.biblio.record_entry.create',
+       #api_level      => 1,
+       #argc           => 2,
+       #note           => <<TEXT,
+#
+#Params should be passed as a hash ref! 
+#Required fields are:
+#
+       #creator
+       #editor
+#
+#Please at least try to fill in:
+#
+       #tcn_source
+       #tcn_value
+       #metarecord
+       #source
+       #active
+#
+#TEXT
+#
+#);
 
 sub update_record_entry {
        my $self = shift;
@@ -60,13 +60,13 @@ sub update_record_entry {
 
        return $success;
 }
-__PACKAGE__->register_method(
-       method          => 'update_record_entry',
-       api_name        => 'open-ils.storage.biblio.record_entry.update',
-       api_level       => 1,
-       argc            => 1,
-);
-
+#__PACKAGE__->register_method(
+       #method         => 'update_record_entry',
+       #api_name       => 'open-ils.storage.biblio.record_entry.update',
+       #api_level      => 1,
+       #argc           => 1,
+#);
+#
 sub delete_record_entry {
        my $self = shift;
        my $client = shift;
@@ -76,13 +76,13 @@ sub delete_record_entry {
        return 0 unless ($rec);
        return 1;
 }
-__PACKAGE__->register_method(
-       method          => 'delete_record_entry',
-       api_name        => 'open-ils.storage.biblio.record_entry.delete',
-       api_level       => 1,
-       argc            => 1,
-);
-
+#__PACKAGE__->register_method(
+       #method         => 'delete_record_entry',
+       #api_name       => 'open-ils.storage.biblio.record_entry.delete',
+       #api_level      => 1,
+       #argc           => 1,
+#);
+#
 sub search_record_entry_one_field {
        my $self = shift;
        my $client = shift;
@@ -101,20 +101,20 @@ sub search_record_entry_one_field {
        }
        return undef;
 }
-__PACKAGE__->register_method(
-       method          => 'search_record_entry_one_field',
-       api_name        => 'open-ils.storage.biblio.record_entry.search.tcn_value',
-       api_level       => 1,
-       argc            => 1,
-       stream          => 1,
-);
-__PACKAGE__->register_method(
-       method          => 'search_record_entry_one_field',
-       api_name        => 'open-ils.storage.biblio.record_entry.search.tcn_value.list',
-       api_level       => 1,
-       argc            => 1,
-       stream          => 1,
-);
+#__PACKAGE__->register_method(
+       #method         => 'search_record_entry_one_field',
+       #api_name       => 'open-ils.storage.biblio.record_entry.search.tcn_value',
+       #api_level      => 1,
+       #argc           => 1,
+       #stream         => 1,
+#);
+#__PACKAGE__->register_method(
+       #method         => 'search_record_entry_one_field',
+       #api_name       => 'open-ils.storage.biblio.record_entry.search.tcn_value.list',
+       #api_level      => 1,
+       #argc           => 1,
+       #stream         => 1,
+#);
 
 sub get_record_entry {
        my $self = shift;
@@ -218,19 +218,19 @@ sub get_record_node {
        }
        return undef;
 }
-__PACKAGE__->register_method(
-       method          => 'get_record_node',
-       api_name        => 'open-ils.storage.biblio.record_node.retrieve',
-       api_level       => 1,
-       argc            => 1,
-);
-__PACKAGE__->register_method(
-       method          => 'get_record_node',
-       api_name        => 'open-ils.storage.biblio.record_node.retrieve.list',
-       api_level       => 1,
-       argc            => 1,
-       stream          => 1,
-);
+#__PACKAGE__->register_method(
+       #method         => 'get_record_node',
+       #api_name       => 'open-ils.storage.biblio.record_node.retrieve',
+       #api_level      => 1,
+       #argc           => 1,
+#);
+#__PACKAGE__->register_method(
+       #method         => 'get_record_node',
+       #api_name       => 'open-ils.storage.biblio.record_node.retrieve.list',
+       #api_level      => 1,
+       ##argc          => 1,
+       #stream         => 1,
+#);
 
 sub create_record_nodeset {
        my $self = shift;
@@ -320,19 +320,19 @@ sub get_record_nodeset {
        }
        return undef;
 }
-__PACKAGE__->register_method(
-       method          => 'get_record_nodeset',
-       api_name        => 'open-ils.storage.biblio.record_entry.nodeset.retrieve',
-       api_level       => 1,
-       argc            => 1,
-);
-__PACKAGE__->register_method(
-       method          => 'get_record_nodeset',
-       api_name        => 'open-ils.storage.biblio.record_entry.nodeset.retrieve.list',
-       api_level       => 1,
-       argc            => 1,
-       stream          => 1,
-);
-
+#__PACKAGE__->register_method(
+       #method         => 'get_record_nodeset',
+       #api_name       => 'open-ils.storage.biblio.record_entry.nodeset.retrieve',
+       #api_level      => 1,
+       #argc           => 1,
+#);
+#__PACKAGE__->register_method(
+       #method         => 'get_record_nodeset',
+       #api_name       => 'open-ils.storage.biblio.record_entry.nodeset.retrieve.list',
+       #api_level      => 1,
+       #argc           => 1,
+       #stream         => 1,
+#);
+#
 
 1;
index a7205b4..7bd4117 100644 (file)
@@ -3,202 +3,53 @@ use base qw/OpenILS::Application::Storage/;
 use vars qw/$VERSION/;
 use OpenSRF::EX qw/:try/;
 use OpenILS::Application::Storage::CDBI::metabib;
+use OpenILS::Application::Storage::FTS;
 use OpenILS::Utils::Fieldmapper;
+use OpenSRF::Utils::Logger;
 
-$VERSION = 1;
-
-sub create_full_rec {
-       my $self = shift;
-       my $client = shift;
-       my $metadata = shift;
-
-       try {
-               my $rec = metabib::full_rec->create($metadata);
-               $client->respond( $rec->id );
-       } catch Error with {
-               $client->respond( 0 );
-       };
-
-       return undef;
-}
-__PACKAGE__->register_method(
-       method          => 'create_full_rec',
-       api_name        => 'open-ils.storage.metabib.full_rec.create',
-       api_level       => 1,
-       argc            => 2,
-       note            =><<TEXT
-Method to create a "full_rec" (Koha) nodeset in the DB.
-0|new->id = open-ils.storage.metabib.full_rec.create ( Fieldmapper::metabib::full_rec );
-TEXT
-
-);
-
-sub update_full_rec {
-       my $self = shift;
-       my $client = shift;
-       my $entry = shift;
-       
-       try {
-               metabib::full_rec->update($entry);
-       } catch Error with {
-               return 0;
-       };
-       return 1;
-}
-__PACKAGE__->register_method(
-       method          => 'update_full_rec',
-       api_name        => 'open-ils.storage.metabib.full_rec.update',
-       api_level       => 1,
-       argc            => 1,
-);
+my $log = 'OpenSRF::Utils::Logger';
 
-sub delete_full_rec {
-       my $self = shift;
-       my $client = shift;
-       my $entry = shift;
-       
-       try {
-               metabib::full_rec->delete($entry);
-       } catch Error with {
-               return 0;
-       };
-       return 1;
-}
-__PACKAGE__->register_method(
-       method          => 'delete_full_rec',
-       api_name        => 'open-ils.storage.metabib.full_rec.delete',
-       api_level       => 1,
-       argc            => 1,
-);
-
-sub get_full_rec {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               my ($rec) = metabib::full_rec->fast_fieldmapper($id);
-               $client->respond( $rec ) if ($rec);
-
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
-}
-__PACKAGE__->register_method(
-       method          => 'get_full_rec',
-       api_name        => 'open-ils.storage.metabib.full_rec.retrieve',
-       api_level       => 1,
-       argc            => 1,
-);
-__PACKAGE__->register_method(
-       method          => 'get_full_rec',
-       api_name        => 'open-ils.storage.metabib.full_rec.retrieve.list',
-       api_level       => 1,
-       argc            => 1,
-       stream          => 1,
-);
+$VERSION = 1;
 
 
-sub create_record_nodeset {
+sub search_full_rec {
        my $self = shift;
        my $client = shift;
-       my @nodes = @_;
+       my $limiters = shift;
+       my $term = shift;
 
-       my $method = $self->method_lookup('open-ils.storage.metabib.record_node.create');
+       my ($fts_col) = metabib::full_rec->columns('FTS');
+       my $table = metabib::full_rec->table;
 
-       my @success;
-       while ( my $node = shift(@nodes) ) {
-               my ($res) = $method->run( $node );
-               push @success, $res if ($res);
-       }
-       
-       my $insert_total = 0;
-       $insert_total += $_ for (@success);
+       my $fts = OpenILS::Application::Storage::FTS->compile($term);
 
-       return $insert_total;
-}
-__PACKAGE__->register_method(
-       method          => 'create_record_nodeset',
-       api_name        => 'open-ils.storage.metabib.record_node.batch.create',
-       api_level       => 1,
-       argc            => 1,
-);
-
-sub update_record_nodeset {
-       my $self = shift;
-       my $client = shift;
+       my $fts_where = $fts->sql_where_clause($fts_col);
+       my @fts_ranks = $fts->fts_rank;
 
-       my $method = $self->method_lookup('open-ils.storage.metabib.record_node.update');
+       my $rank = join(' + ', @fts_ranks);
 
-       my @success;
-       while ( my $node = shift(@_) ) {
-               my ($res) = $method->run( $node );
-               push @success, $res if ($res);
+       my @binds;
+       my @wheres;
+       for my $limit (@$limiters) {
+               push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
+               push @binds, $$limit{tag}, $$limit{subfield};
+               $log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
        }
+       my $where = join(' OR ', @wheres);
 
-       my $update_total = 0;
-       $update_total += $_ for (@success);
-       
-       return $update_total;
-}
-__PACKAGE__->register_method(
-       method          => 'create_record_nodeset',
-       api_name        => 'open-ils.storage.metabib.record_node.batch.update',
-       api_level       => 1,
-       argc            => 1,
-);
+       my $select = "SELECT record, sum($rank) FROM $table WHERE $where GROUP BY 1 ORDER BY 2 DESC;";
 
-sub delete_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-
-       my $method = $self->method_lookup('open-ils.storage.metabib.record_node.delete');
-
-       my @success;
-       while ( my $node = shift(@_) ) {
-               my ($res) = $method->run( $node );
-               push @success, $res if ($res);
-       }
-
-       my $delete_total = 0;
-       $delete_total += $_ for (@success);
-       
-       return $delete_total;
-}
-__PACKAGE__->register_method(
-       method          => 'create_record_nodeset',
-       api_name        => 'open-ils.storage.metabib.record_node.batch.delete',
-       api_level       => 1,
-       argc            => 1,
-);
+       $log->debug("Search SQL :: [$select]",DEBUG);
 
-sub get_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
+       my $recs = metabib::full_rec->db_Main->selectall_arrayref($select, {}, @binds);
+       $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+       return $recs;
 
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               $client->respond( [metabib::record_node->fast_fieldmapper( owner_doc => "$id", {order_by => 'intra_doc_id'} )] );
-               
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
 }
 __PACKAGE__->register_method(
-       method          => 'get_record_nodeset',
-       api_name        => 'open-ils.storage.metabib.full_rec.nodeset.retrieve',
-       api_level       => 1,
-       argc            => 1,
-);
-__PACKAGE__->register_method(
-       method          => 'get_record_nodeset',
-       api_name        => 'open-ils.storage.metabib.full_rec.nodeset.retrieve.list',
+       api_name        => 'open-ils.storage.metabib.full_rec.search.fts',
+       method          => 'search_full_rec',
        api_level       => 1,
-       argc            => 1,
        stream          => 1,
 );
 
index 7e6a17c..af1e100 100644 (file)
@@ -14,13 +14,13 @@ my $xml_util        = OpenILS::Utils::FlatXML->new();
 
 my $parser             = XML::LibXML->new();
 my $xslt                       = XML::LibXSLT->new();
-my $xslt_doc   =       $parser->parse_file( "/pines/cvs/ILS/Open-ILS/xsl/MARC21slim2MODS.xsl" );
+my $xslt_doc   =       $parser->parse_file( "/home/miker/cvs/OpenILS/app_server/stylesheets/MARC21slim2MODS.xsl" );
 my $mods_sheet = $xslt->parse_stylesheet( $xslt_doc );
 
 use open qw/:utf8/;
 
 sub child_init {
-       __PACKAGE__->method_lookup('i.do.not.exist');
+       #__PACKAGE__->method_lookup('i.do.not.exist');
 }
 
 
@@ -108,6 +108,7 @@ sub wormize {
                unless (UNIVERSAL::can($resp, 'content'));
        throw OpenSRF::EX::PANIC ("Transaction creation failed! -- ".$resp->content)
                unless ($resp->content);
+
        $xact_req->finish();
 
 
@@ -139,7 +140,7 @@ sub wormize {
 
        # step 1: build the KOHA rows
        my @ns_list = _marcxml_to_full_rows( $marcdoc );
-       $_->record = $docid for (@ns_list);
+       $_->record( $docid ) for (@ns_list);
 
        my $fr_req = $st_ses->request( 'open-ils.storage.metabib.full_rec.batch.create', @ns_list );
        $fr_req->wait_complete;
@@ -160,27 +161,26 @@ sub wormize {
        $fr_req->finish();
 
        # That's all for now!
-       my $commit_req = $st_ses->request( 'open-ils.storage.trasaction.commit' );
+       my $commit_req = $st_ses->request( 'open-ils.storage.transaction.commit' );
        $commit_req->wait_complete;
 
        $resp = $commit_req->recv;
 
        unless (UNIVERSAL::can($resp, 'content')) {
-               my $rb = $st_ses->request('open-ils.storage.biblio.transaction.rollback');
+               my $rb = $st_ses->request('open-ils.storage.transaction.rollback');
                $rb->wait_complete;
                throw OpenSRF::EX::PANIC ("Error commiting transaction! -- $resp")
        }
        unless ($resp->content) {
-               my $rb = $st_ses->request('open-ils.storage.biblio.transaction.rollback');
+               my $rb = $st_ses->request('open-ils.storage.transaction.rollback');
                $rb->wait_complete;
                throw OpenSRF::EX::PANIC ("Transaction commit failed! -- ".$resp->content)
        }
 
        $commit_req->finish();
 
-       $st_ses->finish();
        $st_ses->disconnect();
-       $st_ses->kill_me();
+       $st_ses->finish();
 
        return 1;
 
index f1b2e7d..2e15519 100644 (file)
@@ -334,7 +334,7 @@ sub method_lookup {
        my $class = ref($self) || $self;
 
        $log->debug("Lookup of [$method] by [$class] in api_level [$proto]", DEBUG);
-       $log->debug("Available methods\n".Dumper(\@_METHODS), INTERNAL);
+       #$log->debug("Available methods\n".Dumper(\@_METHODS), INTERNAL);
 
        my $meth;
        if (__PACKAGE__->thunk) {