add links to biblio and biblioitems
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 12:55:36 +0000 (13:55 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 12:55:36 +0000 (13:55 +0100)
koha/koha2riak-search.pl

index 0d7df0b..be3d145 100755 (executable)
@@ -60,8 +60,12 @@ while(1) {
 #              warn "## $key ",dump($row);
 
                my $headers;
 #              warn "## $key ",dump($row);
 
                my $headers;
-               $headers->{Link} = qq|</riak/koha.biblio/$biblionumber>; riaktag="biblio"|
-               if $biblionumber && $key !~ m/biblionumber/;
+               foreach my $reference ( qw(biblio biblioitem) ) {
+                       my $col = $reference . 'number';
+                       next if $key =~ m/$col/;
+                       my $number = $row->{$col} || next;
+                       push @{ $headers->{Link} }, qq|</riak/koha.$reference/$number>; riaktag="$reference"|;
+               }
 
                $riak->request( 'PUT' => "/koha.$table/$key", $row, $headers );
     }
 
                $riak->request( 'PUT' => "/koha.$table/$key", $row, $headers );
     }