summaryrefslogtreecommitdiff
path: root/rt/sbin/rt-fulltext-indexer
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-06-04 00:21:24 -0700
committerIvan Kohler <ivan@freeside.biz>2013-06-04 00:21:24 -0700
commit679854b8bbc65d112071111bbd7f34a6a481fb30 (patch)
treedda0862fdf7853f4f61e4cf155c8bbc93768c994 /rt/sbin/rt-fulltext-indexer
parent9b328d940af56b9924a342192ebb0790478fa705 (diff)
RT 4.0.13
Diffstat (limited to 'rt/sbin/rt-fulltext-indexer')
-rwxr-xr-xrt/sbin/rt-fulltext-indexer13
1 files changed, 10 insertions, 3 deletions
diff --git a/rt/sbin/rt-fulltext-indexer b/rt/sbin/rt-fulltext-indexer
index 396ef10bd..8ac0e9c21 100755
--- a/rt/sbin/rt-fulltext-indexer
+++ b/rt/sbin/rt-fulltext-indexer
@@ -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)
@@ -374,11 +374,18 @@ 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";
+ if ( $dbh->err == 7 && $dbh->state eq '54000' ) {
+ warn "Attachment @{[$attachment->id]} cannot be indexed, as it contains too many unique words";
+ } elsif ( $dbh->err == 7 && $dbh->state eq '22021' ) {
+ 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;
}
}