This file is indexed.

/usr/lib/perl5/KinoSearch1/Document/Doc.pm is in libkinosearch1-perl 1.00-1build3.

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
package KinoSearch1::Document::Doc;
use strict;
use warnings;
use KinoSearch1::Util::ToolSet;
use base qw( KinoSearch1::Util::Class );

BEGIN {
    __PACKAGE__->init_instance_vars(
        # special member - used to keep track of boost
        _kino_boost => 1,
    );
}

sub set_value {
    my ( $self, $field_name, $value ) = @_;
    carp("undef supplied to set_value") unless defined $value;
    $self->{$field_name}->set_value($value);
}

sub get_value {
    return $_[0]->{ $_[1] }->get_value;
}

sub get_field { $_[0]->{ $_[1] } }

sub boost_field {
    $_[0]->{ $_[1] }->set_boost( $_[2] );
}

sub set_boost { $_[0]->{_kino_boost} = $_[1] }
sub get_boost { $_[0]->{_kino_boost} }

# set the analyzer for a field
sub set_analyzer {
    $_[0]->{ $_[1] }->set_analyzer( $_[2] );
}

sub add_field {
    my ( $self, $field ) = @_;
    croak("argument to add_field must be a KinoSearch1::Document::Field")
        unless $field->isa('KinoSearch1::Document::Field');
    $self->{ $field->get_name } = $field;
}

# retrieve all fields
sub get_fields {
    return grep {ref} values %{ $_[0] };
}

# Return the doc as a hashref, with the field names as hash keys and the
# field # values as values.
sub to_hashref {
    my $self = shift;
    my %hash;
    $hash{ $_->get_name } = $_->get_value for grep {ref} values %$self;
    return \%hash;
}

1;

__END__

=head1 NAME

KinoSearch1::Document::Doc - a document

=head1 SYNOPSIS

    my $doc = $invindexer->new_doc;
    $doc->set_value( title    => $title );
    $doc->set_value( bodytext => $bodytext );
    $invindexer->add($doc);

=head1 DESCRIPTION

A Doc object is akin to a row in a database, in that it is made up of several
fields, each of which has a value.

Doc objects are only created via factory methods of other classes.  

=head1 METHODS

=head2 set_value get_value

    $doc->set_value( title => $title_text );
    my $text = $doc->get_value( 'title' );

C<set_value> and C<get_value> are used to modify and access the values of the
fields within a Doc object.

=head2 set_boost get_boost

    $doc->set_boost(2.5);

C<boost> is a scoring multiplier.  Setting boost to something other than 1
causes a document to score better or worse against a given query relative to
other documents.

=head1 COPYRIGHT

Copyright 2005-2010 Marvin Humphrey

=head1 LICENSE, DISCLAIMER, BUGS, etc.

See L<KinoSearch1> version 1.00.

=cut