/usr/share/perl5/DBIx/FullTextSearch/BlobFast.pm is in libdbix-fulltextsearch-perl 0.73-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | package DBIx::FullTextSearch::BlobFast;
use DBIx::FullTextSearch::Blob;
use vars qw! @ISA !;
@ISA = qw! DBIx::FullTextSearch::Blob !;
use strict;
sub delete_document {
my $self = shift;
my $fts = $self->{'fts'};
my $dbh = $fts->{'dbh'};
my $data_table = $fts->{'data_table'};
my $packstring = $DBIx::FullTextSearch::BITS_TO_PACK{$fts->{'doc_id_bits'}}
. $DBIx::FullTextSearch::BITS_TO_PACK{$fts->{'count_bits'}};
my $value = '';
for my $id (@_) {
$value .= pack $packstring, $id, 0;
}
$dbh->do("
update $data_table set idx = concat(idx, ?)
", {}, $value);
1;
}
sub update_document {
my $self = shift;
$self->delete_document($_[0]);
$self->add_document(@_);
}
sub contains_hashref {
my $self = shift;
my $fts = $self->{'fts'};
my $dbh = $fts->{'dbh'};
my $data_table = $fts->{'data_table'};
my $packstring = $DBIx::FullTextSearch::BITS_TO_PACK{$fts->{'doc_id_bits'}}
. $DBIx::FullTextSearch::BITS_TO_PACK{$fts->{'count_bits'}};
my ($packnulls) = pack $packstring, 0, 0;
my $packlength = length $packnulls;
my $sth = ( defined $self->{'get_idx_sth'} ?
$self->{'get_idx_sth'} :
$self->{'get_idx_sth'} =
$dbh->prepare(
"select idx from $data_table where word like ?"
));
my $out = {};
for my $word (@_) {
$sth->execute($word);
while (my ($blob) = $sth->fetchrow_array) {
next unless defined $blob;
my %docs = ();
my @data;
my $i = length($blob) - $packlength;
while ($i >= 0) {
my ($doc_id, $count) =
unpack "\@$i$packstring", $blob;
### print STDERR "$doc_id $count\n";
$i -= $packlength;
next if exists $docs{$doc_id};
$docs{$doc_id} = 1;
next unless $count;
push @data, $doc_id, $count;
}
while (@data) {
my $doc = shift @data;
my $count = shift @data;
unless (defined $out->{$doc}) { $out->{$doc} = 0; }
$out->{$doc} += $count;
}
}
$sth->finish;
}
$out;
}
*parse_and_index_data = \&DBIx::FullTextSearch::parse_and_index_data_count;
1;
|