This file is indexed.

/usr/share/perl5/Plucene/Index/TermInfosWriter.pm is in libplucene-perl 1.25-3.

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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package Plucene::Index::TermInfosWriter;

=head1 NAME 

Plucene::Index::TermInfosWriter - write to the term infos file

=head1 SYNOPSIS

	my $writer = Plucene::Index::TermInfosWriter->new(
		$dir_name, $segment, $field_infos);

	$writer->add(Plucene::Index::Term $term, 
			Plucene::Index::TermInfo $term_info);

	$writer->write_term(Plucene::Index::Term $term);

=head1 DESCRIPTION

This will allow for the writing and adding to a term infos file for a 
particular segment. It also writes the term infos index.

=head1 METHODS

=cut

use strict;
use warnings;

use constant INDEX_INTERVAL => 128;

use Carp qw(confess carp);

use Plucene::Store::OutputStream;
use Plucene::Index::Term;
use Plucene::Index::TermInfo;

=head2 new

	my $writer = Plucene::Index::TermInfosWriter->new(
		$dir_name, $segment, $field_infos);

This will create a new Plucene::Index::TermInfosWriter object.
		
=cut

sub new {
	my ($class, $d, $segment, $fis, $is_i) = @_;

	my $self = bless {
		field_infos    => $fis,
		is_index       => $is_i,
		size           => 0,
		last_term      => Plucene::Index::Term->new({ field => "", text => "" }),
		last_ti        => Plucene::Index::TermInfo->new,
		last_index_ptr => 0,
		output         => Plucene::Store::OutputStream->new(
			"$d/$segment.ti" . ($is_i ? "i" : "s")
		),
	}, $class;
	confess("No field_infos!") unless $self->{field_infos};
	$self->{output}->write_int(0);    # Will be filled in when DESTROYed
	if (!$is_i) {
		$self->{other} = $class->new($d, $segment, $fis, 1);
		$self->{other}->{other} = $self;    # My enemy's enemy is my friend
	}
	return $self;
}

=head2 break_ref

This will break a circular reference.

=cut

# Damned circular references.
sub break_ref { undef shift->{other} }

=head2 add

	$writer->add(Plucene::Index::Term $term, 
			Plucene::Index::TermInfo $term_info);

This will add the term and term info to the term infos file.
			
=cut

sub add {
	my ($self, $term, $ti) = @_;
	no warnings 'uninitialized';
	carp sprintf "Can't add out-of-order term %s lt %s (%s lt %s)", $term->text,
		$self->{last_term}->text, $term->field, $self->{last_term}->{field}
		if !$self->{is_index} && $term->lt($self->{last_term});
	carp "Frequency pointer out of order"
		if $ti->freq_pointer < $self->{last_ti}->freq_pointer;
	carp "Proximity pointer out of order"
		if $ti->prox_pointer < $self->{last_ti}->prox_pointer;

	$self->{other}->add($self->{last_term}, $self->{last_ti})
		if !$self->{is_index}
		and (($self->{size} % INDEX_INTERVAL) == 0);

	$self->write_term($term);
	$self->{output}->write_vint($ti->doc_freq);
	$self->{output}
		->write_vlong($ti->freq_pointer - $self->{last_ti}->freq_pointer);
	$self->{output}
		->write_vlong($ti->prox_pointer - $self->{last_ti}->prox_pointer);

	if ($self->{is_index}) {    # I bet Tony will think about subclassing
		                          # at this point
		$self->{output}->write_vlong(
			$self->{other}->{output}->tell - $self->{last_index_pointer});
		$self->{last_index_pointer} = $self->{other}->{output}->tell;
	}

	$self->{last_ti} = $ti->clone;
	$self->{size}++;
}

=head2 write_term

	$writer->write_term(Plucene::Index::Term $term);

This will write the term to the term infos file.
	
=cut

sub write_term {
	my ($self, $term) = @_;
	my $text = $term->text || "";
	no warnings 'uninitialized';

	# Find longest common prefix
	($text ^ $self->{last_term}->text) =~ /^(\0*)/;
	my $start = length $1;

	$self->{output}->write_vint($start);
	$self->{output}->write_string(substr($text, $start));
	$self->{output}
		->write_vint($self->{field_infos}->field_number($term->field));
	$self->{last_term} = $term;
}

sub DESTROY {
	my $self = shift;
	$self->{output}->seek(0, 0);
	$self->{output}->write_int($self->{size});
}

1;