From 8913e85bb80b2f410ac74c67c7b1a7ebc6483840 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 13 Nov 2010 23:11:42 +0100 Subject: [PATCH] link marcxml, specify full limit --- koha/koha2riak-search.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/koha/koha2riak-search.pl b/koha/koha2riak-search.pl index d89853f..ed6281c 100755 --- a/koha/koha2riak-search.pl +++ b/koha/koha2riak-search.pl @@ -14,7 +14,7 @@ biblio ); my $limit; -$limit = "LIMIT $ENV{LIMIT}" if $ENV{LIMIT}; +$limit = $ENV{LIMIT} if $ENV{LIMIT}; my $dbh = DBI->connect($dbi,"","") || die $DBI::errstr; my $riak = RiakSearch->new( $riak_url ); @@ -22,10 +22,15 @@ my $riak = RiakSearch->new( $riak_url ); warn $riak->request( 'GET' => '/koha.marcxml' ); sub riak_search_kv_hook { - $riak->request( 'PUT' => shift, { props => { precommit => [ { mod => 'riak_search_kv_hook', fun => 'precommit' } ] } }); + $riak->request( 'PUT' => shift, { props => { + precommit => [ { mod => 'riak_search_kv_hook', fun => 'precommit' } ], +# precommit => [], +# last_write_wins => 'true', + } + }); } -riak_search_kv_hook '/koha.marcxml'; +riak_search_kv_hook 'koha.marcxml'; foreach my $table ( @tables ) { @@ -40,19 +45,21 @@ foreach my $table ( @tables ) { while (my $row = $sth->fetchrow_hashref() ) { my $key = join('_', map { $row->{$_} } @pk); + my $biblionumber = $row->{biblionumber}; if ( my $marcxml = delete $row->{marcxml} ) { $riak->request( 'PUT' => "/koha.marcxml/$key", $marcxml, { 'Content-Type' => 'text/xml', + 'Link' => qq|; riaktag="biblio"|, } ); } # warn "## $key ",dump($row); my $headers; - if ( my $biblionumber = $row->{biblionumber} ) { - $headers->{Link} = qq|; riaktag="biblio"| unless $key =~ m/biblionumber/; - } + $headers->{Link} = qq|; riaktag="biblio"| + if $biblionumber && $key !~ m/biblionumber/; + $riak->request( 'PUT' => "/koha.$table/$key", $row, $headers ); } -- 2.20.1