]> git.uio.no Git - usit-rt.git/blobdiff - sbin/rt-fulltext-indexer
Upgrade to 4.0.10.
[usit-rt.git] / sbin / rt-fulltext-indexer
index b2f4af09851eb68ffb81fb4e0a6ee41a4977ed28..bfb28cb1691be1dc2ce560d715d8245062858805 100755 (executable)
@@ -3,7 +3,7 @@
 #
 # COPYRIGHT:
 #
-# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
 #                                          <sales@bestpractical.com>
 #
 # (Except where explicitly superseded by other copyright notices)
@@ -375,10 +375,17 @@ sub process_pg {
     my $status = eval { $dbh->do( $query, undef, $$text, $attachment->id ) };
     unless ( $status ) {
         if ($dbh->errstr =~ /string is too long for tsvector/) {
-            warn "Attachment @{[$attachment->id]} not indexed, as it contains too many unique words to be indexed";
+            warn "Attachment @{[$attachment->id]} cannot be indexed, as it contains too many unique words";
+        } elsif ($dbh->errstr =~ /invalid byte sequence/) {
+            warn "Attachment @{[$attachment->id]} cannot be indexed, as it contains invalid UTF8 bytes";
         } else {
             die "error: ". $dbh->errstr;
         }
+
+        # Insert an empty tsvector, so we count this row as "indexed"
+        # for purposes of knowing where to pick up
+        eval { $dbh->do( $query, undef, "", $attachment->id ) }
+            or die "Failed to insert empty tsvector: " . $dbh->errstr;
     }
 }