incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [6/14] More API changes, and update and delete documents are noew implemented.
Date Sun, 04 Nov 2012 02:17:15 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/interface/gen-perl/Blur/Lucene.pm
----------------------------------------------------------------------
diff --git a/interface/gen-perl/Blur/Lucene.pm b/interface/gen-perl/Blur/Lucene.pm
index 89d22fa..bae4d11 100644
--- a/interface/gen-perl/Blur/Lucene.pm
+++ b/interface/gen-perl/Blur/Lucene.pm
@@ -281,16 +281,16 @@ sub read {
       {
         /^0$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size279 = 0;
+            my $_size286 = 0;
             $self->{success} = [];
-            my $_etype282 = 0;
-            $xfer += $input->readListBegin(\$_etype282, \$_size279);
-            for (my $_i283 = 0; $_i283 < $_size279; ++$_i283)
+            my $_etype289 = 0;
+            $xfer += $input->readListBegin(\$_etype289, \$_size286);
+            for (my $_i290 = 0; $_i290 < $_size286; ++$_i290)
             {
-              my $elem284 = undef;
-              $elem284 = new Blur::TopFieldDocs();
-              $xfer += $elem284->read($input);
-              push(@{$self->{success}},$elem284);
+              my $elem291 = undef;
+              $elem291 = new Blur::TopFieldDocs();
+              $xfer += $elem291->read($input);
+              push(@{$self->{success}},$elem291);
             }
             $xfer += $input->readListEnd();
           }
@@ -322,9 +322,9 @@ sub write {
       {
         $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{success}}));
         {
-          foreach my $iter285 (@{$self->{success}}) 
+          foreach my $iter292 (@{$self->{success}}) 
           {
-            $xfer += ${iter285}->write($output);
+            $xfer += ${iter292}->write($output);
           }
         }
         $xfer += $output->writeListEnd();
@@ -394,16 +394,16 @@ sub read {
         last; };
         /^2$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size286 = 0;
+            my $_size293 = 0;
             $self->{docLocations} = [];
-            my $_etype289 = 0;
-            $xfer += $input->readListBegin(\$_etype289, \$_size286);
-            for (my $_i290 = 0; $_i290 < $_size286; ++$_i290)
+            my $_etype296 = 0;
+            $xfer += $input->readListBegin(\$_etype296, \$_size293);
+            for (my $_i297 = 0; $_i297 < $_size293; ++$_i297)
             {
-              my $elem291 = undef;
-              $elem291 = new Blur::DocLocation();
-              $xfer += $elem291->read($input);
-              push(@{$self->{docLocations}},$elem291);
+              my $elem298 = undef;
+              $elem298 = new Blur::DocLocation();
+              $xfer += $elem298->read($input);
+              push(@{$self->{docLocations}},$elem298);
             }
             $xfer += $input->readListEnd();
           }
@@ -413,15 +413,15 @@ sub read {
         last; };
         /^4$/ && do{        if ($ftype == TType::SET) {
           {
-            my $_size292 = 0;
+            my $_size299 = 0;
             $self->{fields} = {};
-            my $_etype295 = 0;
-            $xfer += $input->readSetBegin(\$_etype295, \$_size292);
-            for (my $_i296 = 0; $_i296 < $_size292; ++$_i296)
+            my $_etype302 = 0;
+            $xfer += $input->readSetBegin(\$_etype302, \$_size299);
+            for (my $_i303 = 0; $_i303 < $_size299; ++$_i303)
             {
-              my $elem297 = undef;
-              $xfer += $input->readString(\$elem297);
-              $self->{fields}->{$elem297} = 1;
+              my $elem304 = undef;
+              $xfer += $input->readString(\$elem304);
+              $self->{fields}->{$elem304} = 1;
             }
             $xfer += $input->readSetEnd();
           }
@@ -451,9 +451,9 @@ sub write {
       {
         $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{docLocations}}));
         {
-          foreach my $iter298 (@{$self->{docLocations}}) 
+          foreach my $iter305 (@{$self->{docLocations}}) 
           {
-            $xfer += ${iter298}->write($output);
+            $xfer += ${iter305}->write($output);
           }
         }
         $xfer += $output->writeListEnd();
@@ -465,9 +465,9 @@ sub write {
       {
         $xfer += $output->writeSetBegin(TType::STRING, scalar(@{$self->{fields}}));
         {
-          foreach my $iter299 (@{$self->{fields}})
+          foreach my $iter306 (@{$self->{fields}})
           {
-            $xfer += $output->writeString($iter299);
+            $xfer += $output->writeString($iter306);
           }
         }
         $xfer += $output->writeSetEnd();
@@ -521,16 +521,16 @@ sub read {
       {
         /^0$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size300 = 0;
+            my $_size307 = 0;
             $self->{success} = [];
-            my $_etype303 = 0;
-            $xfer += $input->readListBegin(\$_etype303, \$_size300);
-            for (my $_i304 = 0; $_i304 < $_size300; ++$_i304)
+            my $_etype310 = 0;
+            $xfer += $input->readListBegin(\$_etype310, \$_size307);
+            for (my $_i311 = 0; $_i311 < $_size307; ++$_i311)
             {
-              my $elem305 = undef;
-              $elem305 = new Blur::Document();
-              $xfer += $elem305->read($input);
-              push(@{$self->{success}},$elem305);
+              my $elem312 = undef;
+              $elem312 = new Blur::Document();
+              $xfer += $elem312->read($input);
+              push(@{$self->{success}},$elem312);
             }
             $xfer += $input->readListEnd();
           }
@@ -562,9 +562,9 @@ sub write {
       {
         $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{success}}));
         {
-          foreach my $iter306 (@{$self->{success}}) 
+          foreach my $iter313 (@{$self->{success}}) 
           {
-            $xfer += ${iter306}->write($output);
+            $xfer += ${iter313}->write($output);
           }
         }
         $xfer += $output->writeListEnd();
@@ -713,24 +713,20 @@ sub write {
 
 package Blur::Lucene_addDocuments_args;
 use base qw(Class::Accessor);
-Blur::Lucene_addDocuments_args->mk_accessors( qw( table shardIndex document ) );
+Blur::Lucene_addDocuments_args->mk_accessors( qw( options documents ) );
 
 sub new {
     my $classname = shift;
     my $self      = {};
     my $vals      = shift || {};
-    $self->{table} = undef;
-    $self->{shardIndex} = undef;
-    $self->{document} = undef;
+    $self->{options} = undef;
+    $self->{documents} = undef;
     if (UNIVERSAL::isa($vals,'HASH')) {
-      if (defined $vals->{table}) {
-        $self->{table} = $vals->{table};
-      }
-      if (defined $vals->{shardIndex}) {
-        $self->{shardIndex} = $vals->{shardIndex};
+      if (defined $vals->{options}) {
+        $self->{options} = $vals->{options};
       }
-      if (defined $vals->{document}) {
-        $self->{document} = $vals->{document};
+      if (defined $vals->{documents}) {
+        $self->{documents} = $vals->{documents};
       }
     }
     return bless ($self, $classname);
@@ -755,30 +751,25 @@ sub read {
       }
       SWITCH: for($fid)
       {
-        /^1$/ && do{        if ($ftype == TType::STRING) {
-          $xfer += $input->readString(\$self->{table});
-        } else {
-          $xfer += $input->skip($ftype);
-        }
-        last; };
-        /^2$/ && do{        if ($ftype == TType::I32) {
-          $xfer += $input->readI32(\$self->{shardIndex});
+        /^1$/ && do{        if ($ftype == TType::STRUCT) {
+          $self->{options} = new Blur::MutateOptions();
+          $xfer += $self->{options}->read($input);
         } else {
           $xfer += $input->skip($ftype);
         }
         last; };
-        /^3$/ && do{        if ($ftype == TType::LIST) {
+        /^2$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size307 = 0;
-            $self->{document} = [];
-            my $_etype310 = 0;
-            $xfer += $input->readListBegin(\$_etype310, \$_size307);
-            for (my $_i311 = 0; $_i311 < $_size307; ++$_i311)
+            my $_size314 = 0;
+            $self->{documents} = [];
+            my $_etype317 = 0;
+            $xfer += $input->readListBegin(\$_etype317, \$_size314);
+            for (my $_i318 = 0; $_i318 < $_size314; ++$_i318)
             {
-              my $elem312 = undef;
-              $elem312 = new Blur::Document();
-              $xfer += $elem312->read($input);
-              push(@{$self->{document}},$elem312);
+              my $elem319 = undef;
+              $elem319 = new Blur::Document();
+              $xfer += $elem319->read($input);
+              push(@{$self->{documents}},$elem319);
             }
             $xfer += $input->readListEnd();
           }
@@ -798,24 +789,19 @@ sub write {
     my ($self, $output) = @_;
     my $xfer   = 0;
     $xfer += $output->writeStructBegin('Lucene_addDocuments_args');
-    if (defined $self->{table}) {
-      $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
-      $xfer += $output->writeString($self->{table});
-      $xfer += $output->writeFieldEnd();
-    }
-    if (defined $self->{shardIndex}) {
-      $xfer += $output->writeFieldBegin('shardIndex', TType::I32, 2);
-      $xfer += $output->writeI32($self->{shardIndex});
+    if (defined $self->{options}) {
+      $xfer += $output->writeFieldBegin('options', TType::STRUCT, 1);
+      $xfer += $self->{options}->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if (defined $self->{document}) {
-      $xfer += $output->writeFieldBegin('document', TType::LIST, 3);
+    if (defined $self->{documents}) {
+      $xfer += $output->writeFieldBegin('documents', TType::LIST, 2);
       {
-        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{document}}));
+        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{documents}}));
         {
-          foreach my $iter313 (@{$self->{document}}) 
+          foreach my $iter320 (@{$self->{documents}}) 
           {
-            $xfer += ${iter313}->write($output);
+            $xfer += ${iter320}->write($output);
           }
         }
         $xfer += $output->writeListEnd();
@@ -894,21 +880,17 @@ sub write {
 
 package Blur::Lucene_deleteDocumentsByQueries_args;
 use base qw(Class::Accessor);
-Blur::Lucene_deleteDocumentsByQueries_args->mk_accessors( qw( table shardIndex queries ) );
+Blur::Lucene_deleteDocumentsByQueries_args->mk_accessors( qw( options queries ) );
 
 sub new {
     my $classname = shift;
     my $self      = {};
     my $vals      = shift || {};
-    $self->{table} = undef;
-    $self->{shardIndex} = undef;
+    $self->{options} = undef;
     $self->{queries} = undef;
     if (UNIVERSAL::isa($vals,'HASH')) {
-      if (defined $vals->{table}) {
-        $self->{table} = $vals->{table};
-      }
-      if (defined $vals->{shardIndex}) {
-        $self->{shardIndex} = $vals->{shardIndex};
+      if (defined $vals->{options}) {
+        $self->{options} = $vals->{options};
       }
       if (defined $vals->{queries}) {
         $self->{queries} = $vals->{queries};
@@ -936,30 +918,24 @@ sub read {
       }
       SWITCH: for($fid)
       {
-        /^1$/ && do{        if ($ftype == TType::STRING) {
-          $xfer += $input->readString(\$self->{table});
-        } else {
-          $xfer += $input->skip($ftype);
-        }
-        last; };
-        /^2$/ && do{        if ($ftype == TType::I32) {
-          $xfer += $input->readI32(\$self->{shardIndex});
+        /^1$/ && do{        if ($ftype == TType::STRUCT) {
+          $self->{options} = new Blur::MutateOptions();
+          $xfer += $self->{options}->read($input);
         } else {
           $xfer += $input->skip($ftype);
         }
         last; };
-        /^3$/ && do{        if ($ftype == TType::LIST) {
+        /^2$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size314 = 0;
+            my $_size321 = 0;
             $self->{queries} = [];
-            my $_etype317 = 0;
-            $xfer += $input->readListBegin(\$_etype317, \$_size314);
-            for (my $_i318 = 0; $_i318 < $_size314; ++$_i318)
+            my $_etype324 = 0;
+            $xfer += $input->readListBegin(\$_etype324, \$_size321);
+            for (my $_i325 = 0; $_i325 < $_size321; ++$_i325)
             {
-              my $elem319 = undef;
-              $elem319 = new Blur::QueryArgs();
-              $xfer += $elem319->read($input);
-              push(@{$self->{queries}},$elem319);
+              my $elem326 = undef;
+              $xfer += $input->readString(\$elem326);
+              push(@{$self->{queries}},$elem326);
             }
             $xfer += $input->readListEnd();
           }
@@ -979,24 +955,19 @@ sub write {
     my ($self, $output) = @_;
     my $xfer   = 0;
     $xfer += $output->writeStructBegin('Lucene_deleteDocumentsByQueries_args');
-    if (defined $self->{table}) {
-      $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
-      $xfer += $output->writeString($self->{table});
-      $xfer += $output->writeFieldEnd();
-    }
-    if (defined $self->{shardIndex}) {
-      $xfer += $output->writeFieldBegin('shardIndex', TType::I32, 2);
-      $xfer += $output->writeI32($self->{shardIndex});
+    if (defined $self->{options}) {
+      $xfer += $output->writeFieldBegin('options', TType::STRUCT, 1);
+      $xfer += $self->{options}->write($output);
       $xfer += $output->writeFieldEnd();
     }
     if (defined $self->{queries}) {
-      $xfer += $output->writeFieldBegin('queries', TType::LIST, 3);
+      $xfer += $output->writeFieldBegin('queries', TType::LIST, 2);
       {
-        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{queries}}));
+        $xfer += $output->writeListBegin(TType::STRING, scalar(@{$self->{queries}}));
         {
-          foreach my $iter320 (@{$self->{queries}}) 
+          foreach my $iter327 (@{$self->{queries}}) 
           {
-            $xfer += ${iter320}->write($output);
+            $xfer += $output->writeString($iter327);
           }
         }
         $xfer += $output->writeListEnd();
@@ -1075,21 +1046,17 @@ sub write {
 
 package Blur::Lucene_deleteDocuments_args;
 use base qw(Class::Accessor);
-Blur::Lucene_deleteDocuments_args->mk_accessors( qw( table shardIndex terms ) );
+Blur::Lucene_deleteDocuments_args->mk_accessors( qw( options terms ) );
 
 sub new {
     my $classname = shift;
     my $self      = {};
     my $vals      = shift || {};
-    $self->{table} = undef;
-    $self->{shardIndex} = undef;
+    $self->{options} = undef;
     $self->{terms} = undef;
     if (UNIVERSAL::isa($vals,'HASH')) {
-      if (defined $vals->{table}) {
-        $self->{table} = $vals->{table};
-      }
-      if (defined $vals->{shardIndex}) {
-        $self->{shardIndex} = $vals->{shardIndex};
+      if (defined $vals->{options}) {
+        $self->{options} = $vals->{options};
       }
       if (defined $vals->{terms}) {
         $self->{terms} = $vals->{terms};
@@ -1117,30 +1084,25 @@ sub read {
       }
       SWITCH: for($fid)
       {
-        /^1$/ && do{        if ($ftype == TType::STRING) {
-          $xfer += $input->readString(\$self->{table});
-        } else {
-          $xfer += $input->skip($ftype);
-        }
-        last; };
-        /^2$/ && do{        if ($ftype == TType::I32) {
-          $xfer += $input->readI32(\$self->{shardIndex});
+        /^1$/ && do{        if ($ftype == TType::STRUCT) {
+          $self->{options} = new Blur::MutateOptions();
+          $xfer += $self->{options}->read($input);
         } else {
           $xfer += $input->skip($ftype);
         }
         last; };
-        /^3$/ && do{        if ($ftype == TType::LIST) {
+        /^2$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size321 = 0;
+            my $_size328 = 0;
             $self->{terms} = [];
-            my $_etype324 = 0;
-            $xfer += $input->readListBegin(\$_etype324, \$_size321);
-            for (my $_i325 = 0; $_i325 < $_size321; ++$_i325)
+            my $_etype331 = 0;
+            $xfer += $input->readListBegin(\$_etype331, \$_size328);
+            for (my $_i332 = 0; $_i332 < $_size328; ++$_i332)
             {
-              my $elem326 = undef;
-              $elem326 = new Blur::Term();
-              $xfer += $elem326->read($input);
-              push(@{$self->{terms}},$elem326);
+              my $elem333 = undef;
+              $elem333 = new Blur::Term();
+              $xfer += $elem333->read($input);
+              push(@{$self->{terms}},$elem333);
             }
             $xfer += $input->readListEnd();
           }
@@ -1160,24 +1122,19 @@ sub write {
     my ($self, $output) = @_;
     my $xfer   = 0;
     $xfer += $output->writeStructBegin('Lucene_deleteDocuments_args');
-    if (defined $self->{table}) {
-      $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
-      $xfer += $output->writeString($self->{table});
-      $xfer += $output->writeFieldEnd();
-    }
-    if (defined $self->{shardIndex}) {
-      $xfer += $output->writeFieldBegin('shardIndex', TType::I32, 2);
-      $xfer += $output->writeI32($self->{shardIndex});
+    if (defined $self->{options}) {
+      $xfer += $output->writeFieldBegin('options', TType::STRUCT, 1);
+      $xfer += $self->{options}->write($output);
       $xfer += $output->writeFieldEnd();
     }
     if (defined $self->{terms}) {
-      $xfer += $output->writeFieldBegin('terms', TType::LIST, 3);
+      $xfer += $output->writeFieldBegin('terms', TType::LIST, 2);
       {
         $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{terms}}));
         {
-          foreach my $iter327 (@{$self->{terms}}) 
+          foreach my $iter334 (@{$self->{terms}}) 
           {
-            $xfer += ${iter327}->write($output);
+            $xfer += ${iter334}->write($output);
           }
         }
         $xfer += $output->writeListEnd();
@@ -1256,28 +1213,20 @@ sub write {
 
 package Blur::Lucene_updateDocuments_args;
 use base qw(Class::Accessor);
-Blur::Lucene_updateDocuments_args->mk_accessors( qw( table shardIndex terms document ) );
+Blur::Lucene_updateDocuments_args->mk_accessors( qw( options updatePackages ) );
 
 sub new {
     my $classname = shift;
     my $self      = {};
     my $vals      = shift || {};
-    $self->{table} = undef;
-    $self->{shardIndex} = undef;
-    $self->{terms} = undef;
-    $self->{document} = undef;
+    $self->{options} = undef;
+    $self->{updatePackages} = undef;
     if (UNIVERSAL::isa($vals,'HASH')) {
-      if (defined $vals->{table}) {
-        $self->{table} = $vals->{table};
+      if (defined $vals->{options}) {
+        $self->{options} = $vals->{options};
       }
-      if (defined $vals->{shardIndex}) {
-        $self->{shardIndex} = $vals->{shardIndex};
-      }
-      if (defined $vals->{terms}) {
-        $self->{terms} = $vals->{terms};
-      }
-      if (defined $vals->{document}) {
-        $self->{document} = $vals->{document};
+      if (defined $vals->{updatePackages}) {
+        $self->{updatePackages} = $vals->{updatePackages};
       }
     }
     return bless ($self, $classname);
@@ -1302,49 +1251,25 @@ sub read {
       }
       SWITCH: for($fid)
       {
-        /^1$/ && do{        if ($ftype == TType::STRING) {
-          $xfer += $input->readString(\$self->{table});
-        } else {
-          $xfer += $input->skip($ftype);
-        }
-        last; };
-        /^2$/ && do{        if ($ftype == TType::I32) {
-          $xfer += $input->readI32(\$self->{shardIndex});
-        } else {
-          $xfer += $input->skip($ftype);
-        }
-        last; };
-        /^3$/ && do{        if ($ftype == TType::LIST) {
-          {
-            my $_size328 = 0;
-            $self->{terms} = [];
-            my $_etype331 = 0;
-            $xfer += $input->readListBegin(\$_etype331, \$_size328);
-            for (my $_i332 = 0; $_i332 < $_size328; ++$_i332)
-            {
-              my $elem333 = undef;
-              $elem333 = new Blur::Term();
-              $xfer += $elem333->read($input);
-              push(@{$self->{terms}},$elem333);
-            }
-            $xfer += $input->readListEnd();
-          }
+        /^1$/ && do{        if ($ftype == TType::STRUCT) {
+          $self->{options} = new Blur::MutateOptions();
+          $xfer += $self->{options}->read($input);
         } else {
           $xfer += $input->skip($ftype);
         }
         last; };
-        /^4$/ && do{        if ($ftype == TType::LIST) {
+        /^2$/ && do{        if ($ftype == TType::LIST) {
           {
-            my $_size334 = 0;
-            $self->{document} = [];
-            my $_etype337 = 0;
-            $xfer += $input->readListBegin(\$_etype337, \$_size334);
-            for (my $_i338 = 0; $_i338 < $_size334; ++$_i338)
+            my $_size335 = 0;
+            $self->{updatePackages} = [];
+            my $_etype338 = 0;
+            $xfer += $input->readListBegin(\$_etype338, \$_size335);
+            for (my $_i339 = 0; $_i339 < $_size335; ++$_i339)
             {
-              my $elem339 = undef;
-              $elem339 = new Blur::Document();
-              $xfer += $elem339->read($input);
-              push(@{$self->{document}},$elem339);
+              my $elem340 = undef;
+              $elem340 = new Blur::UpdatePackage();
+              $xfer += $elem340->read($input);
+              push(@{$self->{updatePackages}},$elem340);
             }
             $xfer += $input->readListEnd();
           }
@@ -1364,36 +1289,17 @@ sub write {
     my ($self, $output) = @_;
     my $xfer   = 0;
     $xfer += $output->writeStructBegin('Lucene_updateDocuments_args');
-    if (defined $self->{table}) {
-      $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
-      $xfer += $output->writeString($self->{table});
-      $xfer += $output->writeFieldEnd();
-    }
-    if (defined $self->{shardIndex}) {
-      $xfer += $output->writeFieldBegin('shardIndex', TType::I32, 2);
-      $xfer += $output->writeI32($self->{shardIndex});
+    if (defined $self->{options}) {
+      $xfer += $output->writeFieldBegin('options', TType::STRUCT, 1);
+      $xfer += $self->{options}->write($output);
       $xfer += $output->writeFieldEnd();
     }
-    if (defined $self->{terms}) {
-      $xfer += $output->writeFieldBegin('terms', TType::LIST, 3);
+    if (defined $self->{updatePackages}) {
+      $xfer += $output->writeFieldBegin('updatePackages', TType::LIST, 2);
       {
-        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{terms}}));
+        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{updatePackages}}));
         {
-          foreach my $iter340 (@{$self->{terms}}) 
-          {
-            $xfer += ${iter340}->write($output);
-          }
-        }
-        $xfer += $output->writeListEnd();
-      }
-      $xfer += $output->writeFieldEnd();
-    }
-    if (defined $self->{document}) {
-      $xfer += $output->writeFieldBegin('document', TType::LIST, 4);
-      {
-        $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{document}}));
-        {
-          foreach my $iter341 (@{$self->{document}}) 
+          foreach my $iter341 (@{$self->{updatePackages}}) 
           {
             $xfer += ${iter341}->write($output);
           }
@@ -1510,17 +1416,15 @@ sub closeReadSession{
 
 sub addDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $document = shift;
+  my $options = shift;
+  my $documents = shift;
 
   die 'implement interface';
 }
 
 sub deleteDocumentsByQueries{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $queries = shift;
 
   die 'implement interface';
@@ -1528,8 +1432,7 @@ sub deleteDocumentsByQueries{
 
 sub deleteDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $terms = shift;
 
   die 'implement interface';
@@ -1537,10 +1440,8 @@ sub deleteDocuments{
 
 sub updateDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $terms = shift;
-  my $document = shift;
+  my $options = shift;
+  my $updatePackages = shift;
 
   die 'implement interface';
 }
@@ -1584,38 +1485,33 @@ sub closeReadSession{
 sub addDocuments{
     my ($self, $request) = @_;
 
-    my $table = ($request->{'table'}) ? $request->{'table'} : undef;
-    my $shardIndex = ($request->{'shardIndex'}) ? $request->{'shardIndex'} : undef;
-    my $document = ($request->{'document'}) ? $request->{'document'} : undef;
-    return $self->{impl}->addDocuments($table, $shardIndex, $document);
+    my $options = ($request->{'options'}) ? $request->{'options'} : undef;
+    my $documents = ($request->{'documents'}) ? $request->{'documents'} : undef;
+    return $self->{impl}->addDocuments($options, $documents);
   }
 
 sub deleteDocumentsByQueries{
     my ($self, $request) = @_;
 
-    my $table = ($request->{'table'}) ? $request->{'table'} : undef;
-    my $shardIndex = ($request->{'shardIndex'}) ? $request->{'shardIndex'} : undef;
+    my $options = ($request->{'options'}) ? $request->{'options'} : undef;
     my $queries = ($request->{'queries'}) ? $request->{'queries'} : undef;
-    return $self->{impl}->deleteDocumentsByQueries($table, $shardIndex, $queries);
+    return $self->{impl}->deleteDocumentsByQueries($options, $queries);
   }
 
 sub deleteDocuments{
     my ($self, $request) = @_;
 
-    my $table = ($request->{'table'}) ? $request->{'table'} : undef;
-    my $shardIndex = ($request->{'shardIndex'}) ? $request->{'shardIndex'} : undef;
+    my $options = ($request->{'options'}) ? $request->{'options'} : undef;
     my $terms = ($request->{'terms'}) ? $request->{'terms'} : undef;
-    return $self->{impl}->deleteDocuments($table, $shardIndex, $terms);
+    return $self->{impl}->deleteDocuments($options, $terms);
   }
 
 sub updateDocuments{
     my ($self, $request) = @_;
 
-    my $table = ($request->{'table'}) ? $request->{'table'} : undef;
-    my $shardIndex = ($request->{'shardIndex'}) ? $request->{'shardIndex'} : undef;
-    my $terms = ($request->{'terms'}) ? $request->{'terms'} : undef;
-    my $document = ($request->{'document'}) ? $request->{'document'} : undef;
-    return $self->{impl}->updateDocuments($table, $shardIndex, $terms, $document);
+    my $options = ($request->{'options'}) ? $request->{'options'} : undef;
+    my $updatePackages = ($request->{'updatePackages'}) ? $request->{'updatePackages'} : undef;
+    return $self->{impl}->updateDocuments($options, $updatePackages);
   }
 
 package Blur::LuceneClient;
@@ -1821,25 +1717,22 @@ sub recv_closeReadSession{
 }
 sub addDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $document = shift;
+  my $options = shift;
+  my $documents = shift;
 
-        $self->send_addDocuments($table, $shardIndex, $document);
+        $self->send_addDocuments($options, $documents);
     $self->recv_addDocuments();
 }
 
 sub send_addDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $document = shift;
+  my $options = shift;
+  my $documents = shift;
 
     $self->{output}->writeMessageBegin('addDocuments', TMessageType::CALL, $self->{seqid});
     my $args = new Blur::Lucene_addDocuments_args();
-    $args->{table} = $table;
-    $args->{shardIndex} = $shardIndex;
-    $args->{document} = $document;
+    $args->{options} = $options;
+    $args->{documents} = $documents;
     $args->write($self->{output});
     $self->{output}->writeMessageEnd();
     $self->{output}->getTransport()->flush();
@@ -1870,24 +1763,21 @@ sub recv_addDocuments{
 }
 sub deleteDocumentsByQueries{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $queries = shift;
 
-        $self->send_deleteDocumentsByQueries($table, $shardIndex, $queries);
+        $self->send_deleteDocumentsByQueries($options, $queries);
     $self->recv_deleteDocumentsByQueries();
 }
 
 sub send_deleteDocumentsByQueries{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $queries = shift;
 
     $self->{output}->writeMessageBegin('deleteDocumentsByQueries', TMessageType::CALL, $self->{seqid});
     my $args = new Blur::Lucene_deleteDocumentsByQueries_args();
-    $args->{table} = $table;
-    $args->{shardIndex} = $shardIndex;
+    $args->{options} = $options;
     $args->{queries} = $queries;
     $args->write($self->{output});
     $self->{output}->writeMessageEnd();
@@ -1919,24 +1809,21 @@ sub recv_deleteDocumentsByQueries{
 }
 sub deleteDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $terms = shift;
 
-        $self->send_deleteDocuments($table, $shardIndex, $terms);
+        $self->send_deleteDocuments($options, $terms);
     $self->recv_deleteDocuments();
 }
 
 sub send_deleteDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
+  my $options = shift;
   my $terms = shift;
 
     $self->{output}->writeMessageBegin('deleteDocuments', TMessageType::CALL, $self->{seqid});
     my $args = new Blur::Lucene_deleteDocuments_args();
-    $args->{table} = $table;
-    $args->{shardIndex} = $shardIndex;
+    $args->{options} = $options;
     $args->{terms} = $terms;
     $args->write($self->{output});
     $self->{output}->writeMessageEnd();
@@ -1968,28 +1855,22 @@ sub recv_deleteDocuments{
 }
 sub updateDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $terms = shift;
-  my $document = shift;
+  my $options = shift;
+  my $updatePackages = shift;
 
-        $self->send_updateDocuments($table, $shardIndex, $terms, $document);
+        $self->send_updateDocuments($options, $updatePackages);
     $self->recv_updateDocuments();
 }
 
 sub send_updateDocuments{
   my $self = shift;
-  my $table = shift;
-  my $shardIndex = shift;
-  my $terms = shift;
-  my $document = shift;
+  my $options = shift;
+  my $updatePackages = shift;
 
     $self->{output}->writeMessageBegin('updateDocuments', TMessageType::CALL, $self->{seqid});
     my $args = new Blur::Lucene_updateDocuments_args();
-    $args->{table} = $table;
-    $args->{shardIndex} = $shardIndex;
-    $args->{terms} = $terms;
-    $args->{document} = $document;
+    $args->{options} = $options;
+    $args->{updatePackages} = $updatePackages;
     $args->write($self->{output});
     $self->{output}->writeMessageEnd();
     $self->{output}->getTransport()->flush();
@@ -2120,7 +2001,7 @@ sub process_addDocuments {
       $input->readMessageEnd();
       my $result = new Blur::Lucene_addDocuments_result();
       eval {
-        $self->{handler}->addDocuments($args->table, $args->shardIndex, $args->document);
+        $self->{handler}->addDocuments($args->options, $args->documents);
       }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
         $result->{e} = $@;
       }
@@ -2137,7 +2018,7 @@ sub process_deleteDocumentsByQueries {
       $input->readMessageEnd();
       my $result = new Blur::Lucene_deleteDocumentsByQueries_result();
       eval {
-        $self->{handler}->deleteDocumentsByQueries($args->table, $args->shardIndex, $args->queries);
+        $self->{handler}->deleteDocumentsByQueries($args->options, $args->queries);
       }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
         $result->{e} = $@;
       }
@@ -2154,7 +2035,7 @@ sub process_deleteDocuments {
       $input->readMessageEnd();
       my $result = new Blur::Lucene_deleteDocuments_result();
       eval {
-        $self->{handler}->deleteDocuments($args->table, $args->shardIndex, $args->terms);
+        $self->{handler}->deleteDocuments($args->options, $args->terms);
       }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
         $result->{e} = $@;
       }
@@ -2171,7 +2052,7 @@ sub process_updateDocuments {
       $input->readMessageEnd();
       my $result = new Blur::Lucene_updateDocuments_result();
       eval {
-        $self->{handler}->updateDocuments($args->table, $args->shardIndex, $args->terms, $args->document);
+        $self->{handler}->updateDocuments($args->options, $args->updatePackages);
       }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
         $result->{e} = $@;
       }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/interface/gen-perl/Blur/Types.pm
----------------------------------------------------------------------
diff --git a/interface/gen-perl/Blur/Types.pm b/interface/gen-perl/Blur/Types.pm
index 0deec99..6bb1262 100644
--- a/interface/gen-perl/Blur/Types.pm
+++ b/interface/gen-perl/Blur/Types.pm
@@ -4620,4 +4620,215 @@ sub write {
   return $xfer;
 }
 
+package Blur::MutateOptions;
+use base qw(Class::Accessor);
+Blur::MutateOptions->mk_accessors( qw( table shardIndex waitToBeVisible writeAheadLog ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{table} = undef;
+  $self->{shardIndex} = undef;
+  $self->{waitToBeVisible} = undef;
+  $self->{writeAheadLog} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{table}) {
+      $self->{table} = $vals->{table};
+    }
+    if (defined $vals->{shardIndex}) {
+      $self->{shardIndex} = $vals->{shardIndex};
+    }
+    if (defined $vals->{waitToBeVisible}) {
+      $self->{waitToBeVisible} = $vals->{waitToBeVisible};
+    }
+    if (defined $vals->{writeAheadLog}) {
+      $self->{writeAheadLog} = $vals->{writeAheadLog};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'MutateOptions';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{table});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^2$/ && do{      if ($ftype == TType::I32) {
+        $xfer += $input->readI32(\$self->{shardIndex});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^3$/ && do{      if ($ftype == TType::BOOL) {
+        $xfer += $input->readBool(\$self->{waitToBeVisible});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^4$/ && do{      if ($ftype == TType::BOOL) {
+        $xfer += $input->readBool(\$self->{writeAheadLog});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('MutateOptions');
+  if (defined $self->{table}) {
+    $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
+    $xfer += $output->writeString($self->{table});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{shardIndex}) {
+    $xfer += $output->writeFieldBegin('shardIndex', TType::I32, 2);
+    $xfer += $output->writeI32($self->{shardIndex});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{waitToBeVisible}) {
+    $xfer += $output->writeFieldBegin('waitToBeVisible', TType::BOOL, 3);
+    $xfer += $output->writeBool($self->{waitToBeVisible});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{writeAheadLog}) {
+    $xfer += $output->writeFieldBegin('writeAheadLog', TType::BOOL, 4);
+    $xfer += $output->writeBool($self->{writeAheadLog});
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::UpdatePackage;
+use base qw(Class::Accessor);
+Blur::UpdatePackage->mk_accessors( qw( term documents ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{term} = undef;
+  $self->{documents} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{term}) {
+      $self->{term} = $vals->{term};
+    }
+    if (defined $vals->{documents}) {
+      $self->{documents} = $vals->{documents};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'UpdatePackage';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRUCT) {
+        $self->{term} = new Blur::Term();
+        $xfer += $self->{term}->read($input);
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^2$/ && do{      if ($ftype == TType::LIST) {
+        {
+          my $_size198 = 0;
+          $self->{documents} = [];
+          my $_etype201 = 0;
+          $xfer += $input->readListBegin(\$_etype201, \$_size198);
+          for (my $_i202 = 0; $_i202 < $_size198; ++$_i202)
+          {
+            my $elem203 = undef;
+            $elem203 = new Blur::Document();
+            $xfer += $elem203->read($input);
+            push(@{$self->{documents}},$elem203);
+          }
+          $xfer += $input->readListEnd();
+        }
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('UpdatePackage');
+  if (defined $self->{term}) {
+    $xfer += $output->writeFieldBegin('term', TType::STRUCT, 1);
+    $xfer += $self->{term}->write($output);
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{documents}) {
+    $xfer += $output->writeFieldBegin('documents', TType::LIST, 2);
+    {
+      $xfer += $output->writeListBegin(TType::STRUCT, scalar(@{$self->{documents}}));
+      {
+        foreach my $iter204 (@{$self->{documents}}) 
+        {
+          $xfer += ${iter204}->write($output);
+        }
+      }
+      $xfer += $output->writeListEnd();
+    }
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
 1;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/interface/gen-rb/blur_types.rb
----------------------------------------------------------------------
diff --git a/interface/gen-rb/blur_types.rb b/interface/gen-rb/blur_types.rb
index 48b89da..019ef62 100644
--- a/interface/gen-rb/blur_types.rb
+++ b/interface/gen-rb/blur_types.rb
@@ -1052,4 +1052,44 @@ module Blur
     ::Thrift::Struct.generate_accessors self
   end
 
+  class MutateOptions
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    TABLE = 1
+    SHARDINDEX = 2
+    WAITTOBEVISIBLE = 3
+    WRITEAHEADLOG = 4
+
+    FIELDS = {
+      TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
+      SHARDINDEX => {:type => ::Thrift::Types::I32, :name => 'shardIndex'},
+      WAITTOBEVISIBLE => {:type => ::Thrift::Types::BOOL, :name => 'waitToBeVisible'},
+      WRITEAHEADLOG => {:type => ::Thrift::Types::BOOL, :name => 'writeAheadLog'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class UpdatePackage
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    TERM = 1
+    DOCUMENTS = 2
+
+    FIELDS = {
+      TERM => {:type => ::Thrift::Types::STRUCT, :name => 'term', :class => ::Blur::Term},
+      DOCUMENTS => {:type => ::Thrift::Types::LIST, :name => 'documents', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Document}}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
 end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/interface/gen-rb/lucene.rb
----------------------------------------------------------------------
diff --git a/interface/gen-rb/lucene.rb b/interface/gen-rb/lucene.rb
index 3dbcdb6..c83cb84 100644
--- a/interface/gen-rb/lucene.rb
+++ b/interface/gen-rb/lucene.rb
@@ -76,13 +76,13 @@ module Blur
         return
       end
 
-      def addDocuments(table, shardIndex, document)
-        send_addDocuments(table, shardIndex, document)
+      def addDocuments(options, documents)
+        send_addDocuments(options, documents)
         recv_addDocuments()
       end
 
-      def send_addDocuments(table, shardIndex, document)
-        send_message('addDocuments', AddDocuments_args, :table => table, :shardIndex => shardIndex, :document => document)
+      def send_addDocuments(options, documents)
+        send_message('addDocuments', AddDocuments_args, :options => options, :documents => documents)
       end
 
       def recv_addDocuments()
@@ -91,13 +91,13 @@ module Blur
         return
       end
 
-      def deleteDocumentsByQueries(table, shardIndex, queries)
-        send_deleteDocumentsByQueries(table, shardIndex, queries)
+      def deleteDocumentsByQueries(options, queries)
+        send_deleteDocumentsByQueries(options, queries)
         recv_deleteDocumentsByQueries()
       end
 
-      def send_deleteDocumentsByQueries(table, shardIndex, queries)
-        send_message('deleteDocumentsByQueries', DeleteDocumentsByQueries_args, :table => table, :shardIndex => shardIndex, :queries => queries)
+      def send_deleteDocumentsByQueries(options, queries)
+        send_message('deleteDocumentsByQueries', DeleteDocumentsByQueries_args, :options => options, :queries => queries)
       end
 
       def recv_deleteDocumentsByQueries()
@@ -106,13 +106,13 @@ module Blur
         return
       end
 
-      def deleteDocuments(table, shardIndex, terms)
-        send_deleteDocuments(table, shardIndex, terms)
+      def deleteDocuments(options, terms)
+        send_deleteDocuments(options, terms)
         recv_deleteDocuments()
       end
 
-      def send_deleteDocuments(table, shardIndex, terms)
-        send_message('deleteDocuments', DeleteDocuments_args, :table => table, :shardIndex => shardIndex, :terms => terms)
+      def send_deleteDocuments(options, terms)
+        send_message('deleteDocuments', DeleteDocuments_args, :options => options, :terms => terms)
       end
 
       def recv_deleteDocuments()
@@ -121,13 +121,13 @@ module Blur
         return
       end
 
-      def updateDocuments(table, shardIndex, terms, document)
-        send_updateDocuments(table, shardIndex, terms, document)
+      def updateDocuments(options, updatePackages)
+        send_updateDocuments(options, updatePackages)
         recv_updateDocuments()
       end
 
-      def send_updateDocuments(table, shardIndex, terms, document)
-        send_message('updateDocuments', UpdateDocuments_args, :table => table, :shardIndex => shardIndex, :terms => terms, :document => document)
+      def send_updateDocuments(options, updatePackages)
+        send_message('updateDocuments', UpdateDocuments_args, :options => options, :updatePackages => updatePackages)
       end
 
       def recv_updateDocuments()
@@ -189,7 +189,7 @@ module Blur
         args = read_args(iprot, AddDocuments_args)
         result = AddDocuments_result.new()
         begin
-          @handler.addDocuments(args.table, args.shardIndex, args.document)
+          @handler.addDocuments(args.options, args.documents)
         rescue ::Blur::BlurException => e
           result.e = e
         end
@@ -200,7 +200,7 @@ module Blur
         args = read_args(iprot, DeleteDocumentsByQueries_args)
         result = DeleteDocumentsByQueries_result.new()
         begin
-          @handler.deleteDocumentsByQueries(args.table, args.shardIndex, args.queries)
+          @handler.deleteDocumentsByQueries(args.options, args.queries)
         rescue ::Blur::BlurException => e
           result.e = e
         end
@@ -211,7 +211,7 @@ module Blur
         args = read_args(iprot, DeleteDocuments_args)
         result = DeleteDocuments_result.new()
         begin
-          @handler.deleteDocuments(args.table, args.shardIndex, args.terms)
+          @handler.deleteDocuments(args.options, args.terms)
         rescue ::Blur::BlurException => e
           result.e = e
         end
@@ -222,7 +222,7 @@ module Blur
         args = read_args(iprot, UpdateDocuments_args)
         result = UpdateDocuments_result.new()
         begin
-          @handler.updateDocuments(args.table, args.shardIndex, args.terms, args.document)
+          @handler.updateDocuments(args.options, args.updatePackages)
         rescue ::Blur::BlurException => e
           result.e = e
         end
@@ -375,14 +375,12 @@ module Blur
 
     class AddDocuments_args
       include ::Thrift::Struct, ::Thrift::Struct_Union
-      TABLE = 1
-      SHARDINDEX = 2
-      DOCUMENT = 3
+      OPTIONS = 1
+      DOCUMENTS = 2
 
       FIELDS = {
-        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
-        SHARDINDEX => {:type => ::Thrift::Types::I32, :name => 'shardIndex'},
-        DOCUMENT => {:type => ::Thrift::Types::LIST, :name => 'document', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Document}}
+        OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Blur::MutateOptions},
+        DOCUMENTS => {:type => ::Thrift::Types::LIST, :name => 'documents', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Document}}
       }
 
       def struct_fields; FIELDS; end
@@ -411,14 +409,12 @@ module Blur
 
     class DeleteDocumentsByQueries_args
       include ::Thrift::Struct, ::Thrift::Struct_Union
-      TABLE = 1
-      SHARDINDEX = 2
-      QUERIES = 3
+      OPTIONS = 1
+      QUERIES = 2
 
       FIELDS = {
-        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
-        SHARDINDEX => {:type => ::Thrift::Types::I32, :name => 'shardIndex'},
-        QUERIES => {:type => ::Thrift::Types::LIST, :name => 'queries', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::QueryArgs}}
+        OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Blur::MutateOptions},
+        QUERIES => {:type => ::Thrift::Types::LIST, :name => 'queries', :element => {:type => ::Thrift::Types::STRING, :binary => true}}
       }
 
       def struct_fields; FIELDS; end
@@ -447,13 +443,11 @@ module Blur
 
     class DeleteDocuments_args
       include ::Thrift::Struct, ::Thrift::Struct_Union
-      TABLE = 1
-      SHARDINDEX = 2
-      TERMS = 3
+      OPTIONS = 1
+      TERMS = 2
 
       FIELDS = {
-        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
-        SHARDINDEX => {:type => ::Thrift::Types::I32, :name => 'shardIndex'},
+        OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Blur::MutateOptions},
         TERMS => {:type => ::Thrift::Types::LIST, :name => 'terms', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Term}}
       }
 
@@ -483,16 +477,12 @@ module Blur
 
     class UpdateDocuments_args
       include ::Thrift::Struct, ::Thrift::Struct_Union
-      TABLE = 1
-      SHARDINDEX = 2
-      TERMS = 3
-      DOCUMENT = 4
+      OPTIONS = 1
+      UPDATEPACKAGES = 2
 
       FIELDS = {
-        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
-        SHARDINDEX => {:type => ::Thrift::Types::I32, :name => 'shardIndex'},
-        TERMS => {:type => ::Thrift::Types::LIST, :name => 'terms', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Term}},
-        DOCUMENT => {:type => ::Thrift::Types::LIST, :name => 'document', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::Document}}
+        OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Blur::MutateOptions},
+        UPDATEPACKAGES => {:type => ::Thrift::Types::LIST, :name => 'updatePackages', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Blur::UpdatePackage}}
       }
 
       def struct_fields; FIELDS; end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
index f15d810..6cd8e41 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndex.java
@@ -17,11 +17,13 @@ package org.apache.blur.manager.writer;
  * limitations under the License.
  */
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.blur.thrift.generated.Document;
 import org.apache.blur.thrift.generated.Row;
+import org.apache.blur.thrift.generated.Term;
 import org.apache.lucene.index.IndexReader;
 
 public abstract class BlurIndex {
@@ -41,5 +43,8 @@ public abstract class BlurIndex {
   public abstract void optimize(int numberOfSegmentsPerShard) throws IOException;
 
   public abstract void addDocuments(boolean waitToBeVisible, boolean wal, List<Document> documents) throws IOException;
+  public abstract void updateDocuments(boolean waitToBeVisible, boolean wal, Term deleteTerm, List<Document> documents) throws IOException;
+  public abstract void deleteDocuments(boolean waitToBeVisible, boolean wal, Term... deleteTerm) throws IOException;
+  public abstract void deleteDocuments(boolean waitToBeVisible, boolean wal, ByteBuffer... deleteQueries) throws IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
index c37046e..deba51e 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexReader.java
@@ -19,6 +19,7 @@ package org.apache.blur.manager.writer;
 import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.List;
 
 import org.apache.blur.index.IndexWriter;
@@ -26,6 +27,7 @@ import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.thrift.generated.Document;
 import org.apache.blur.thrift.generated.Row;
+import org.apache.blur.thrift.generated.Term;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexWriterConfig;
@@ -76,4 +78,19 @@ public class BlurIndexReader extends AbstractBlurIndex {
   public void addDocuments(boolean waitToBeVisible, boolean wal, List<Document> documents) throws IOException {
     throw new RuntimeException("Read-only shard");
   }
+
+  @Override
+  public void updateDocuments(boolean waitToBeVisible, boolean wal, Term deleteTerm, List<Document> documents) throws IOException {
+    throw new RuntimeException("Read-only shard");
+  }
+
+  @Override
+  public void deleteDocuments(boolean waitToBeVisible, boolean wal, Term... deleteTerm) throws IOException {
+    throw new RuntimeException("Read-only shard");
+  }
+
+  @Override
+  public void deleteDocuments(boolean waitToBeVisible, boolean wal, ByteBuffer... deleteQueries) throws IOException {
+    throw new RuntimeException("Read-only shard"); 
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurNRTIndex.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurNRTIndex.java b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurNRTIndex.java
index 37ec4a8..7e9c277 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurNRTIndex.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/BlurNRTIndex.java
@@ -19,6 +19,7 @@ package org.apache.blur.manager.writer;
 import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -33,6 +34,7 @@ import org.apache.blur.lucene.store.refcounter.DirectoryReferenceFileGC;
 import org.apache.blur.thrift.generated.Document;
 import org.apache.blur.thrift.generated.Record;
 import org.apache.blur.thrift.generated.Row;
+import org.apache.blur.thrift.generated.Term;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.lucene.codecs.appending.AppendingCodec;
@@ -126,41 +128,28 @@ public class BlurNRTIndex extends BlurIndex {
     startRefresher();
   }
 
-  private void startRefresher() {
-    double targetMinStaleSec = _timeBetweenRefreshs / 1000.0;
-    _refresher = new NRTManagerReopenThread(_nrtManager, targetMinStaleSec * 10, targetMinStaleSec);
-    _refresher.setName("Refresh Thread [" + _table + "/" + _shard + "]");
-    _refresher.setDaemon(true);
-    _refresher.start();
+  @Override
+  public void addDocuments(boolean waitToBeVisible, boolean wal, List<Document> documents) throws IOException {
+    long generation = _recorder.addDocuments(wal, documents, _trackingWriter);
+    waitToBeVisible(waitToBeVisible, generation);
   }
 
-  private void startCommiter() {
-    _committer = new Thread(new Runnable() {
-      @Override
-      public void run() {
-        while (!_isClosed.get()) {
-          try {
-            LOG.info("Committing of [{0}/{1}].", _table, _shard);
-            _recorder.commit(_writer);
-          } catch (CorruptIndexException e) {
-            LOG.error("Curruption Error during commit of [{0}/{1}].", e, _table, _shard);
-          } catch (IOException e) {
-            LOG.error("IO Error during commit of [{0}/{1}].", e, _table, _shard);
-          }
-          try {
-            Thread.sleep(_timeBetweenCommits);
-          } catch (InterruptedException e) {
-            if (_isClosed.get()) {
-              return;
-            }
-            LOG.error("Unknown error with committer thread [{0}/{1}].", e, _table, _shard);
-          }
-        }
-      }
-    });
-    _committer.setDaemon(true);
-    _committer.setName("Commit Thread [" + _table + "/" + _shard + "]");
-    _committer.start();
+  @Override
+  public void updateDocuments(boolean waitToBeVisible, boolean wal, Term deleteTerm, List<Document> documents) throws IOException {
+    long generation = _recorder.updateDocuments(wal, deleteTerm, documents, _trackingWriter);
+    waitToBeVisible(waitToBeVisible, generation);
+  }
+
+  @Override
+  public void deleteDocuments(boolean waitToBeVisible, boolean wal, Term... deleteTerm) throws IOException {
+    long generation = _recorder.deleteDocuments(wal, deleteTerm, _trackingWriter);
+    waitToBeVisible(waitToBeVisible, generation);
+  }
+
+  @Override
+  public void deleteDocuments(boolean waitToBeVisible, boolean wal, ByteBuffer... deleteQueries) throws IOException {
+    long generation = _recorder.deleteDocuments(wal, deleteQueries, _trackingWriter);
+    waitToBeVisible(waitToBeVisible, generation);
   }
 
   @Override
@@ -295,10 +284,41 @@ public class BlurNRTIndex extends BlurIndex {
     _gc = gc;
   }
 
-  @Override
-  public void addDocuments(boolean waitToBeVisible, boolean wal, List<Document> documents) throws IOException {
-    long generation = _recorder.addDocuments(wal, documents, _trackingWriter);
-    waitToBeVisible(waitToBeVisible, generation);
+  private void startRefresher() {
+    double targetMinStaleSec = _timeBetweenRefreshs / 1000.0;
+    _refresher = new NRTManagerReopenThread(_nrtManager, targetMinStaleSec * 10, targetMinStaleSec);
+    _refresher.setName("Refresh Thread [" + _table + "/" + _shard + "]");
+    _refresher.setDaemon(true);
+    _refresher.start();
+  }
+
+  private void startCommiter() {
+    _committer = new Thread(new Runnable() {
+      @Override
+      public void run() {
+        while (!_isClosed.get()) {
+          try {
+            LOG.info("Committing of [{0}/{1}].", _table, _shard);
+            _recorder.commit(_writer);
+          } catch (CorruptIndexException e) {
+            LOG.error("Curruption Error during commit of [{0}/{1}].", e, _table, _shard);
+          } catch (IOException e) {
+            LOG.error("IO Error during commit of [{0}/{1}].", e, _table, _shard);
+          }
+          try {
+            Thread.sleep(_timeBetweenCommits);
+          } catch (InterruptedException e) {
+            if (_isClosed.get()) {
+              return;
+            }
+            LOG.error("Unknown error with committer thread [{0}/{1}].", e, _table, _shard);
+          }
+        }
+      }
+    });
+    _committer.setDaemon(true);
+    _committer.setName("Commit Thread [" + _table + "/" + _shard + "]");
+    _committer.start();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java b/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
index 8cca5d5..8afe293 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
@@ -22,6 +22,7 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.EOFException;
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -48,11 +49,12 @@ import org.apache.hadoop.record.Utils;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.FieldType;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.NRTManager.TrackingIndexWriter;
+import static org.apache.blur.thrift.lucene.Convert.*;
 
 public class TransactionRecorder {
 
@@ -89,6 +91,7 @@ public class TransactionRecorder {
     ID_TYPE.setTokenized(false);
     ID_TYPE.setOmitNorms(true);
     ID_TYPE.setStored(true);
+    ID_TYPE.freeze();
   }
 
   private AtomicBoolean running = new AtomicBoolean(true);
@@ -357,8 +360,25 @@ public class TransactionRecorder {
   public long addDocuments(boolean wal, List<org.apache.blur.thrift.generated.Document> documents, TrackingIndexWriter writer) throws IOException {
     List<Document> docs = new ArrayList<Document>();
     for (org.apache.blur.thrift.generated.Document doc : documents) {
-      docs.add(BlurUtil.convert(doc));
+      docs.add(toLucene(doc));
     }
     return writer.addDocuments(docs);
   }
+
+  public long updateDocuments(boolean wal, org.apache.blur.thrift.generated.Term deleteTerm, List<org.apache.blur.thrift.generated.Document> documents, TrackingIndexWriter writer)
+      throws IOException {
+    List<Document> docs = new ArrayList<Document>();
+    for (org.apache.blur.thrift.generated.Document doc : documents) {
+      docs.add(toLucene(doc));
+    }
+    return writer.updateDocuments(toLucene(deleteTerm), docs);
+  }
+
+  public long deleteDocuments(boolean wal, org.apache.blur.thrift.generated.Term[] deleteTerm, TrackingIndexWriter writer) throws IOException {
+    return writer.deleteDocuments(toLucene(deleteTerm));
+  }
+
+  public long deleteDocuments(boolean wal, ByteBuffer[] deleteQueries, TrackingIndexWriter writer) throws IOException {
+    return writer.deleteDocuments(toLucene(deleteQueries));
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index cf39e7d..a46a61f 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -21,6 +21,7 @@ import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_CACHE_MAX_TIMETOLIV
 import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_DATA_FETCH_THREAD_COUNT;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -54,6 +55,7 @@ import org.apache.blur.thrift.generated.DocLocation;
 import org.apache.blur.thrift.generated.Document;
 import org.apache.blur.thrift.generated.FetchResult;
 import org.apache.blur.thrift.generated.Lucene.Iface;
+import org.apache.blur.thrift.generated.MutateOptions;
 import org.apache.blur.thrift.generated.QueryArgs;
 import org.apache.blur.thrift.generated.RowMutation;
 import org.apache.blur.thrift.generated.Schema;
@@ -62,6 +64,8 @@ import org.apache.blur.thrift.generated.Session;
 import org.apache.blur.thrift.generated.TableStats;
 import org.apache.blur.thrift.generated.Term;
 import org.apache.blur.thrift.generated.TopFieldDocs;
+import org.apache.blur.thrift.generated.UpdatePackage;
+import org.apache.blur.thrift.lucene.Convert;
 import org.apache.blur.utils.BlurConstants;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.QueryCache;
@@ -74,7 +78,7 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.Sort;
 import org.apache.thrift.TException;
-
+import static org.apache.blur.thrift.lucene.Convert.*;
 public class BlurShardServer extends TableAdmin implements Iface {
 
   private static final Log LOG = LogFactory.getLog(BlurShardServer.class);
@@ -407,10 +411,10 @@ public class BlurShardServer extends TableAdmin implements Iface {
       Collection<Entry<Integer, IndexSearcher>> searchersToSearch = getSearchers(shardIndexes, searchers);
 
       List<Future<TopFieldDocs>> futures = new ArrayList<Future<TopFieldDocs>>(searchersToSearch.size());
-      Query query = BlurUtil.getQuery(queryArgs);
-      Filter filter = BlurUtil.getFilter(queryArgs);
-      Sort sort = BlurUtil.getSort(queryArgs);
-      ScoreDoc after = BlurUtil.convert(queryArgs.getAfter());
+      Query query = Convert.toLucene(queryArgs);
+      Filter filter = Convert.toLuceneFilter(queryArgs);
+      Sort sort = Convert.toLuceneSort(queryArgs);
+      ScoreDoc after = Convert.toLucene(queryArgs.getAfter());
       boolean doDocScores = queryArgs.isDoDocScores();
       boolean doMaxScore = queryArgs.isDoMaxScore();
       int numberToFetch = queryArgs.getNumberToFetch();
@@ -472,15 +476,15 @@ public class BlurShardServer extends TableAdmin implements Iface {
     private TopFieldDocs doSearch() throws IOException {
       if (after == null) {
         if (sort == null) {
-          return BlurUtil.convert(searcher.search(query, filter, count));
+          return toThrift(searcher.search(query, filter, count));
         } else {
-          return BlurUtil.convert(searcher.search(query, filter, count, sort, doDocScores, doMaxScore));
+          return toThrift(searcher.search(query, filter, count, sort, doDocScores, doMaxScore));
         }
       } else {
         if (sort == null) {
-          return BlurUtil.convert(searcher.searchAfter(after, query, filter, count));
+          return toThrift(searcher.searchAfter(after, query, filter, count));
         } else {
-          return BlurUtil.convert((org.apache.lucene.search.TopFieldDocs) searcher.searchAfter(after, query, filter, count, sort, doDocScores, doMaxScore));
+          return toThrift((org.apache.lucene.search.TopFieldDocs) searcher.searchAfter(after, query, filter, count, sort, doDocScores, doMaxScore));
         }
       }
     }
@@ -531,7 +535,7 @@ public class BlurShardServer extends TableAdmin implements Iface {
       List<Document> result = new ArrayList<Document>();
       for (DocLocation docLocation : docLocations) {
         IndexSearcher searcher = searchers.get(docLocation.getShardIndex());
-        result.add(BlurUtil.convert(searcher.document(docLocation.getDoc(), fieldsToLoad)));
+        result.add(toThrift(searcher.document(docLocation.getDoc(), fieldsToLoad)));
       }
       return result;
     } catch (Throwable t) {
@@ -547,17 +551,14 @@ public class BlurShardServer extends TableAdmin implements Iface {
   }
 
   @Override
-  public void addDocuments(String table, int shardIndex, List<Document> documents) throws BlurException, TException {
+  public void addDocuments(MutateOptions options, List<Document> documents) throws BlurException, TException {
+    String table = options.getTable();
+    int shardIndex = options.getShardIndex();
+    boolean waitToBeVisible = options.isWaitToBeVisible();
+    boolean writeAheadLog = options.isWriteAheadLog();
     try {
-      Map<String, BlurIndex> blurIndexes;
-      try {
-        blurIndexes = _indexServer.getIndexes(table);
-      } catch (IOException e) {
-        LOG.error("Unknown error while trying to fetch index readers.", e);
-        throw new BException(e.getMessage(), e);
-      }
-      BlurIndex index = blurIndexes.get(BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, shardIndex));
-      index.addDocuments(false, false, documents);
+      BlurIndex index = getIndex(table, shardIndex);
+      index.addDocuments(waitToBeVisible, writeAheadLog, documents);
     } catch (Throwable t) {
       LOG.error("Unknown error", t);
       throw new BException(t.getMessage(), t);
@@ -565,18 +566,61 @@ public class BlurShardServer extends TableAdmin implements Iface {
   }
 
   @Override
-  public void deleteDocumentsByQueries(String table, int shardIndex, List<QueryArgs> queries) throws BlurException, TException {
-
+  public void deleteDocumentsByQueries(MutateOptions options, List<ByteBuffer> queries) throws BlurException, TException {
+    String table = options.getTable();
+    int shardIndex = options.getShardIndex();
+    boolean waitToBeVisible = options.isWaitToBeVisible();
+    boolean writeAheadLog = options.isWriteAheadLog();
+    try {
+      BlurIndex index = getIndex(table, shardIndex);
+      index.deleteDocuments(waitToBeVisible, writeAheadLog, queries.toArray(new ByteBuffer[queries.size()]));
+    } catch (Throwable t) {
+      LOG.error("Unknown error", t);
+      throw new BException(t.getMessage(), t);
+    }
   }
 
   @Override
-  public void deleteDocuments(String table, int shardIndex, List<Term> terms) throws BlurException, TException {
-
+  public void deleteDocuments(MutateOptions options, List<Term> terms) throws BlurException, TException {
+    String table = options.getTable();
+    int shardIndex = options.getShardIndex();
+    boolean waitToBeVisible = options.isWaitToBeVisible();
+    boolean writeAheadLog = options.isWriteAheadLog();
+    try {
+      BlurIndex index = getIndex(table, shardIndex);
+      index.deleteDocuments(waitToBeVisible, writeAheadLog, terms.toArray(new Term[terms.size()]));
+    } catch (Throwable t) {
+      LOG.error("Unknown error", t);
+      throw new BException(t.getMessage(), t);
+    }
   }
 
   @Override
-  public void updateDocuments(String table, int shardIndex, List<Term> terms, List<Document> document) throws BlurException, TException {
-
+  public void updateDocuments(MutateOptions options, List<UpdatePackage> updatePackages) throws BlurException, TException {
+    String table = options.getTable();
+    int shardIndex = options.getShardIndex();
+    boolean waitToBeVisible = options.isWaitToBeVisible();
+    boolean writeAheadLog = options.isWriteAheadLog();
+    try {
+      BlurIndex index = getIndex(table, shardIndex);
+      for (UpdatePackage updatePackage : updatePackages) {
+        index.updateDocuments(waitToBeVisible, writeAheadLog, updatePackage.getTerm(), updatePackage.getDocuments());
+      }
+    } catch (Throwable t) {
+      LOG.error("Unknown error", t);
+      throw new BException(t.getMessage(), t);
+    }
   }
 
+  private BlurIndex getIndex(String table, int shardIndex) throws BException {
+    Map<String, BlurIndex> blurIndexes;
+    try {
+      blurIndexes = _indexServer.getIndexes(table);
+    } catch (IOException e) {
+      LOG.error("Unknown error while trying to fetch index readers.", e);
+      throw new BException(e.getMessage(), e);
+    }
+    BlurIndex index = blurIndexes.get(BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, shardIndex));
+    return index;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e18a556/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java b/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
new file mode 100644
index 0000000..9b81d1c
--- /dev/null
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
@@ -0,0 +1,420 @@
+package org.apache.blur.thrift.lucene;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.blur.log.Log;
+import org.apache.blur.log.LogFactory;
+import org.apache.blur.lucene.serializer.QueryWritable;
+import org.apache.blur.thrift.generated.DocLocation;
+import org.apache.blur.thrift.generated.Field;
+import org.apache.blur.thrift.generated.QueryArgs;
+import org.apache.blur.thrift.generated.ScoreDoc;
+import org.apache.blur.thrift.generated.SortField;
+import org.apache.blur.thrift.generated.SortType;
+import org.apache.blur.thrift.generated.TYPE;
+import org.apache.blur.thrift.generated.TopFieldDocs;
+import org.apache.hadoop.io.DataInputBuffer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.DoubleField;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.FloatField;
+import org.apache.lucene.document.IntField;
+import org.apache.lucene.document.LongField;
+import org.apache.lucene.document.StoredField;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.SortField.Type;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.util.BytesRef;
+
+public class Convert {
+  
+  private static final Log LOG = LogFactory.getLog(Convert.class);
+  
+  public static TopFieldDocs toThrift(TopDocs topDocs) {
+    return toThrift(new org.apache.lucene.search.TopFieldDocs(topDocs.totalHits, topDocs.scoreDocs, null, Float.NaN));
+  }
+
+  public static org.apache.lucene.search.ScoreDoc toLucene(org.apache.blur.thrift.generated.ScoreDoc scoreDoc) {
+    if (scoreDoc == null) {
+      return null;
+    }
+    return new org.apache.lucene.search.ScoreDoc(scoreDoc.docLocation.doc, (float) scoreDoc.score, scoreDoc.docLocation.shardIndex);
+  }
+
+  public static org.apache.blur.thrift.generated.Document toThrift(org.apache.lucene.document.Document document) {
+    org.apache.blur.thrift.generated.Document result = new org.apache.blur.thrift.generated.Document();
+    List<IndexableField> fields = document.getFields();
+    for (IndexableField field : fields) {
+      result.addToFields(toThrift(field));
+    }
+    return result;
+  }
+
+  public static Field toThrift(IndexableField field) {
+    Field result = new Field();
+    result.setBoost(field.boost());
+    result.setName(field.name());
+    Number number = field.numericValue();
+    if (number != null) {
+      if (number instanceof Byte || number instanceof Short || number instanceof Integer) {
+        result.setType(TYPE.INT);
+        result.setValue(toByteBuffer((Integer) number));
+      } else if (number instanceof Long) {
+        result.setType(TYPE.LONG);
+        result.setValue(toByteBuffer((Long) number));
+      } else if (number instanceof Float) {
+        result.setType(TYPE.FLOAT);
+        result.setValue(toByteBuffer((Float) number));
+      } else if (number instanceof Double) {
+        result.setType(TYPE.DOUBLE);
+        result.setValue(toByteBuffer((Double) number));
+      } else {
+        throw new IllegalArgumentException("cannot store numeric type " + number.getClass());
+      }
+    } else {
+      BytesRef bytes = field.binaryValue();
+      if (bytes != null) {
+        result.setType(TYPE.BINARY);
+        result.setValue(toByteBuffer(bytes));
+      } else {
+        result.setType(TYPE.STRING);
+        result.setValue(toByteBuffer(field.stringValue()));
+      }
+    }
+    return result;
+  }
+
+  public static ByteBuffer toByteBuffer(String val) {
+    if (val == null) {
+      return null;
+    }
+    return toByteBuffer(new BytesRef(val));
+  }
+
+  public static ByteBuffer toByteBuffer(BytesRef val) {
+    if (val == null) {
+      return null;
+    }
+    return flip(ByteBuffer.allocate(val.length).put(val.bytes, val.offset, val.length));
+  }
+
+  private static ByteBuffer flip(ByteBuffer buffer) {
+    buffer.flip();
+    return buffer;
+  }
+
+  public static ByteBuffer toByteBuffer(Double val) {
+    if (val == null) {
+      return null;
+    }
+    return flip(ByteBuffer.allocate(8).putDouble(val));
+  }
+
+  public static ByteBuffer toByteBuffer(Long val) {
+    if (val == null) {
+      return null;
+    }
+    return flip(ByteBuffer.allocate(8).putLong(val));
+  }
+
+  public static ByteBuffer toByteBuffer(Float val) {
+    if (val == null) {
+      return null;
+    }
+    return flip(ByteBuffer.allocate(4).putFloat(val));
+  }
+
+  public static ByteBuffer toByteBuffer(Integer val) {
+    if (val == null) {
+      return null;
+    }
+    return flip(ByteBuffer.allocate(4).putInt(val));
+  }
+
+  public static List<DocLocation> toThrift(List<ScoreDoc> scoreDocs) {
+    List<DocLocation> result = new ArrayList<DocLocation>(scoreDocs.size());
+    for (ScoreDoc scoreDoc : scoreDocs) {
+      result.add(scoreDoc.getDocLocation());
+    }
+    return result;
+  }
+
+  public static String toString(org.apache.blur.thrift.generated.Document document) {
+    StringBuilder builder = new StringBuilder();
+    builder.append('{');
+    for (Field f : document.getFields()) {
+      if (builder.length() != 0) {
+        builder.append(',');
+      }
+      builder.append(toString(f));
+    }
+    builder.append('}');
+    return builder.toString();
+  }
+
+  public static String toString(Field f) {
+    StringBuilder builder = new StringBuilder();
+    builder.append('{');
+    String name = f.getName();
+    builder.append(name);
+    builder.append(',');
+
+    TYPE type = f.getType();
+    builder.append(type.name());
+    builder.append(',');
+
+    byte[] value = f.getValue();
+    builder.append(toString(type, value));
+    builder.append(',');
+
+    double boost = f.getBoost();
+    builder.append(boost);
+    builder.append('}');
+    return builder.toString();
+  }
+
+  public static String toString(TYPE type, byte[] value) {
+    switch (type) {
+    case STRING:
+      return new BytesRef(value).utf8ToString();
+    case INT:
+      return Integer.toString(ByteBuffer.wrap(value).getInt());
+    case LONG:
+      return Long.toString(ByteBuffer.wrap(value).getLong());
+    case FLOAT:
+      return Float.toString(ByteBuffer.wrap(value).getFloat());
+    case DOUBLE:
+      return Double.toString(ByteBuffer.wrap(value).getDouble());
+    case BINARY:
+      return ByteBuffer.wrap(value).toString();
+    default:
+      throw new RuntimeException("Type unknown.");
+    }
+  }
+
+  public static Document toLucene(org.apache.blur.thrift.generated.Document document) throws IOException {
+    Document result = new Document();
+    List<Field> fields = document.getFields();
+    for (Field field : fields) {
+      result.add(toLucene(field));
+    }
+    return result;
+  }
+
+  public static IndexableField toLucene(Field field) throws IOException {
+    TYPE type = field.getType();
+    org.apache.lucene.document.Field result;
+    switch (type) {
+    case STRING:
+      result = new StringField(field.getName(), toString(field.getValue()), Store.YES);
+      break;
+    case TEXT:
+      result = new TextField(field.getName(), toString(field.getValue()), Store.YES);
+      break;
+    case INT:
+      result = new IntField(field.getName(), toInteger(field.getValue()), Store.YES);
+      break;
+    case FLOAT:
+      result = new FloatField(field.getName(), toFloat(field.getValue()), Store.YES);
+      break;
+    case LONG:
+      result = new LongField(field.getName(), toLong(field.getValue()), Store.YES);
+      break;
+    case DOUBLE:
+      result = new DoubleField(field.getName(), toDouble(field.getValue()), Store.YES);
+      break;
+    case BINARY:
+      result = new StoredField(field.getName(), field.getValue());
+      break;
+    default:
+      throw new RuntimeException("Not supported");
+    }
+    FieldType fieldType = result.fieldType();
+    if (fieldType.indexed() && !fieldType.omitNorms()) {
+      result.setBoost((float) field.getBoost());
+    }
+    return result;
+  }
+
+  public static double toDouble(byte[] value) {
+    throw new RuntimeException("Not implemented");
+  }
+
+  public static long toLong(byte[] value) {
+    throw new RuntimeException("Not implemented");
+  }
+
+  public static float toFloat(byte[] value) {
+    throw new RuntimeException("Not implemented");
+  }
+
+  public static int toInteger(byte[] value) {
+    throw new RuntimeException("Not implemented");
+  }
+
+  public static String toString(byte[] value) throws IOException {
+    return new String(value, "UTF-8");
+  }
+
+  public static Term toLucene(org.apache.blur.thrift.generated.Term term) {
+    return new Term(term.getField(), new BytesRef(term.getBytes()));
+  }
+
+  public static Term[] toLucene(org.apache.blur.thrift.generated.Term[] terms) {
+    Term[] result = new Term[terms.length];
+    for (int i = 0; i < terms.length; i++) {
+      result[i] = toLucene(terms[i]);
+    }
+    return result;
+  }
+  
+  public static Query[] toLucene(ByteBuffer[] queries) throws IOException {
+    Query[] result = new Query[queries.length];
+    for (int i = 0; i < queries.length; i++) {
+      result[i] = toLuceneQuery(queries[i]);
+    }
+    return result;
+  }
+  
+  public static Query toLucene(QueryArgs queryArgs) throws IOException {
+    return toLuceneQuery(queryArgs.query);
+  }
+  
+  public static Query toLuceneQuery(ByteBuffer buf) throws IOException {
+    DataInputBuffer in = new DataInputBuffer();
+    in.reset(buf.array(), buf.arrayOffset(), buf.limit());
+    QueryWritable qw = new QueryWritable();
+    qw.readFields(in);
+    return qw.getQuery();
+  }
+
+  public static Filter toLuceneFilter(QueryArgs queryArgs) {
+    byte[] filter = queryArgs.getFilter();
+    return null;
+  }
+
+  public static Sort toLuceneSort(QueryArgs queryArgs) {
+    return null;
+  }
+  
+  public static TopFieldDocs toThrift(org.apache.lucene.search.TopFieldDocs topFieldDocs) {
+    TopFieldDocs result = new TopFieldDocs();
+    result.setFields(toThrift(topFieldDocs.fields));
+    result.setMaxScore(topFieldDocs.getMaxScore());
+    result.setScoreDocs(toThrift(topFieldDocs.scoreDocs));
+    result.setTotalHits(topFieldDocs.totalHits);
+    return result;
+  }
+
+  public static List<ScoreDoc> toThrift(org.apache.lucene.search.ScoreDoc[] scoreDocs) {
+    List<ScoreDoc> result = new ArrayList<ScoreDoc>(scoreDocs.length);
+    for (int i = 0; i < scoreDocs.length; i++) {
+      org.apache.lucene.search.ScoreDoc scoreDoc = scoreDocs[i];
+      if (scoreDoc instanceof org.apache.lucene.search.FieldDoc) {
+        result.add(toThrift((org.apache.lucene.search.FieldDoc) scoreDoc));
+      } else {
+        result.add(toThrift(scoreDoc));
+      }
+    }
+    return result;
+  }
+
+  public List<ScoreDoc> toThrift(org.apache.lucene.search.FieldDoc[] fieldDocs) {
+    List<ScoreDoc> result = new ArrayList<ScoreDoc>(fieldDocs.length);
+    for (int i = 0; i < fieldDocs.length; i++) {
+      result.add(toThrift(fieldDocs[i]));
+    }
+    return result;
+  }
+
+  public static List<SortField> toThrift(org.apache.lucene.search.SortField[] fields) {
+    if (fields == null) {
+      return null;
+    }
+    List<SortField> result = new ArrayList<SortField>(fields.length);
+    for (int i = 0; i < fields.length; i++) {
+      result.add(toThrift(fields[i]));
+    }
+    return result;
+  }
+
+  public static SortField toThrift(org.apache.lucene.search.SortField sortField) {
+    if (sortField == null) {
+      return null;
+    }
+    SortField result = new SortField();
+    result.setField(sortField.getField());
+    result.setReverse(sortField.getReverse());
+    result.setType(toThrift(sortField.getType()));
+    return result;
+  }
+
+  public static ScoreDoc toThrift(org.apache.lucene.search.ScoreDoc scoreDoc) {
+    if (scoreDoc == null) {
+      return null;
+    }
+    ScoreDoc result = new ScoreDoc();
+    result.setDocLocation(new DocLocation(scoreDoc.doc, scoreDoc.shardIndex));
+    result.setScore(scoreDoc.score);
+    return result;
+  }
+
+  public static ScoreDoc toThrift(org.apache.lucene.search.FieldDoc fieldDoc) {
+    if (fieldDoc == null) {
+      return null;
+    }
+    ScoreDoc result = new ScoreDoc();
+    result.setDocLocation(new DocLocation(fieldDoc.doc, fieldDoc.shardIndex));
+    result.setFields(convert(fieldDoc.fields));
+    result.setScore(fieldDoc.score);
+    return result;
+  }
+
+  public static SortType toThrift(Type type) {
+    if (type == null) {
+      return null;
+    }
+    switch (type) {
+    case BYTE:
+      return SortType.BYTE;
+    case BYTES:
+      return SortType.BYTES;
+    case SCORE:
+      return SortType.SCORE;
+    case DOC:
+      return SortType.DOC;
+    case STRING:
+      return SortType.STRING;
+    case INT:
+      return SortType.INT;
+    case FLOAT:
+      return SortType.FLOAT;
+    case LONG:
+      return SortType.LONG;
+    case DOUBLE:
+      return SortType.DOUBLE;
+    case SHORT:
+      return SortType.SHORT;
+    case STRING_VAL:
+      return SortType.STRING_VAL;
+    default:
+      throw new RuntimeException("Not supported");
+    }
+  }
+
+  public static List<ByteBuffer> convert(Object[] fields) {
+    // throw new RuntimeException("Not supported YET!");
+    LOG.error("Not supported YET!");
+    return null;
+  }
+}


Mime
View raw message