riak_search_kv_hook
[NoSQL-toys.git] / koha / koha2riak-search.pl
index 8035135..ee43900 100755 (executable)
@@ -16,7 +16,11 @@ biblio
 my $dbh = DBI->connect($dbi,"","") || die $DBI::errstr;
 my $riak = Net::Riak->new(host => $riak_url );
 
-#my $marcxml_bucket = $riak->bucket( 'koha.marcxml' );
+my $xml_bucket = $riak->bucket( 'koha.marcxml' );
+$xml_bucket->set_properties({
+       precommit => [ { mod => 'riak_search_kv_hook', fun => 'precommit' } ],
+});
+
 
 foreach my $table ( @tables ) {
 
@@ -27,6 +31,9 @@ foreach my $table ( @tables ) {
     print "import ", $sth->rows, " rows from $table pk:",dump( @pk ),"...\n";
 
     my $bucket = $riak->bucket( 'koha.' . $table );
+       $bucket->set_properties({
+               precommit => [ { mod => 'riak_search_kv_hook', fun => 'precommit' } ],
+       });
 
     while (my $row = $sth->fetchrow_hashref() ) {