This file is indexed.

/usr/share/perl5/Plucene/Index/FieldsWriter.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
package Plucene::Index::FieldsWriter;

=head1 NAME 

Plucene::Index::FieldsWriter - writes Fields to a Document

=head1 SYNOPSIS

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

	$writer->add_document(Plucene::Document $doc);

=head1 DESCRIPTION

This class add documents to the appropriate files.

=head1 METHODS

=cut

use strict;
use warnings;

use Plucene::Store::OutputStream;
use Plucene::Index::FieldInfos;

=head2 new

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

This will create a new Plucene::Index::FieldsWriter object with the passed
directory name, segment and field infos.
		
=cut

# private FieldInfos fieldInfos;
# private OutputStream fieldsStream;
# private OutputStream indexStream;

# FieldsWriter(Directory d, String segment, FieldInfos fn)
#      throws IOException {
#   fieldInfos = fn;
#   fieldsStream = d.createFile(segment + ".fdt");
#   indexStream = d.createFile(segment + ".fdx");
# }

sub new {
	my ($self, $d, $segment, $fn) = @_;
	bless {
		field_infos   => $fn,
		segment       => $segment,
		fields_stream => Plucene::Store::OutputStream->new("$d/$segment.fdt"),
		index_stream  => Plucene::Store::OutputStream->new("$d/$segment.fdx"),
	}, $self;
}

=head2 close

	$writer->close;

=cut

# final void close() throws IOException {
#   fieldsStream.close();
#   indexStream.close();
# }

sub close {
	my $self = shift;
	$self->{fields_stream}->close;
	$self->{index_stream}->close;
}

=head2 add_document

	$writer->add_document(Plucene::Document $doc);

This will add the passed Plucene::Document.

=cut

# final void addDocument(Document doc) throws IOException {
#   indexStream.writeLong(fieldsStream.getFilePointer());
#
#   int storedCount = 0;
#   Enumeration fields  = doc.fields();
#   while (fields.hasMoreElements()) {
#     Field field = (Field)fields.nextElement();
#     if (field.isStored())
#       storedCount++;
#   }
#   fieldsStream.writeVInt(storedCount);
#
#   fields  = doc.fields();
#   while (fields.hasMoreElements()) {
#     Field field = (Field)fields.nextElement();
#     if (field.isStored()) {
#       fieldsStream.writeVInt(fieldInfos.fieldNumber(field.name()));
#
#       byte bits = 0;
#       if (field.isTokenized())
#         bits |= 1;
#       fieldsStream.writeByte(bits);
#
#       fieldsStream.writeString(field.stringValue());
#     }
#   }
# }

sub add_document {
	my ($self, $doc) = @_;
	$self->{index_stream}->write_long($self->{fields_stream}->tell);
	my @stored = grep $_->is_stored, $doc->fields;
	$self->{fields_stream}->write_vint(scalar @stored);
	for my $field (@stored) {
		$self->{fields_stream}
			->write_vint($self->{field_infos}->field_number($field->name));
		$self->{fields_stream}->print(chr($field->is_tokenized));
		$self->{fields_stream}->write_string($field->string);
	}
}

1;