import records in batches, support w=2
[NoSQL-toys.git] / koha / RiakSearch.pm
index be2bcb5..b80c16c 100644 (file)
@@ -19,6 +19,7 @@ sub new {
        return bless {
                ua  => $ua,
                url => $url,
+               args => '',
        }, $class;
 }
 
@@ -28,8 +29,10 @@ sub request {
        my $full_url = $self->{url} . "/riak/$uri";
        $full_url =~ s{//+}{/}g;
        $full_url =~ s{http:/}{http://};
+       $full_url .= '?' . $self->{args} if $self->{args};
 
        $headers->{'Content-Type'} = 'application/json' unless exists $headers->{'Content-Type'};
+       $headers->{'Host'} = $1 if $full_url =~ m{http://([^/]+)};
 
        my $req;
 
@@ -41,7 +44,6 @@ sub request {
        }
 
        $req->header( $_ => $headers->{$_} ) foreach keys %$headers;
-       $req->header( 'Host' => $1 ) if $self->{url} =~ m{http://([^/]+)};
 
 #      warn "## $method $full_url ", dump($req, $content);
        my $response = $self->{ua}->request($req);