This file is indexed.

/usr/lib/perl5/KinoSearch1/Search/Weight.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
package KinoSearch1::Search::Weight;
use strict;
use warnings;
use KinoSearch1::Util::ToolSet;
use base qw( KinoSearch1::Util::Class );

BEGIN {
    __PACKAGE__->init_instance_vars(
        # constructor args / members
        parent   => undef,
        searcher => undef,
        # members
        similarity   => undef,
        value        => 0,
        idf          => undef,
        query_norm   => undef,
        query_weight => undef,
    );
}

# Return the Query that the Weight was derived from.
sub get_query { shift->{parent} }

# Return the Weight's numerical value, now that it's been calculated.
sub get_value { shift->{value} }

# Return a damping/normalization factor for the Weight/Query.
sub sum_of_squared_weights {
    my $self = shift;
    $self->{query_weight} = $self->{idf} * $self->{parent}->get_boost;
    return ( $self->{query_weight}**2 );
}

# Normalize the Weight/Query, so that it produces more comparable numbers in
# context of other Weights/Queries.

sub normalize {
    my ( $self, $query_norm ) = @_;
    $self->{query_norm} = $query_norm;
    $self->{query_weight} *= $query_norm;
    $self->{value} = $self->{query_weight} * $self->{idf};
}

=begin comment

    my $scorer = $weight->scorer( $index_reader );

Return a subclass of scorer, primed with values and ready to crunch numbers.

=end comment
=cut

sub scorer { shift->abstract_death }

=begin comment

    my $explanation = $weight->explain( $index_reader, $doc_num );

Explain how a document scores.

=end comment
=cut

sub explain { shift->todo_death }

sub to_string {
    my $self = shift;
    return "weight(" . $self->{parent}->to_string . ")";
}

1;

=begin devdocs

=head1 NAME

KinoSearch1::Search::Weight - Searcher-dependent transformation of a Query

=head1 SYNOPSIS

    # abstract base class

=head1 DESCRIPTION

In one sense, a Weight is the weight of a Query object.  Conceptually, a
Query's "weight" ought to be a single number: a co-efficient... and indeed,
eventually a Weight object gets turned into a $weight_value.

However, since calculating that multiplier is rather complex, the calculations
are encapsulated within a class.  

=head1 COPYRIGHT

Copyright 2005-2010 Marvin Humphrey

=head1 LICENSE, DISCLAIMER, BUGS, etc.

See L<KinoSearch1> version 1.00.

=end devdocs
=cut