normsreader.pm

来自「外国人写的Perl搜索引擎程序」· PM 代码 · 共 74 行

PM
74
字号
package KinoSearch::Index::NormsReader;use strict;use warnings;use KinoSearch::Util::ToolSet;use base qw( KinoSearch::Util::Class );BEGIN {    __PACKAGE__->init_instance_vars(        # constructor params / members        instream => undef,        max_doc  => undef,        bytes    => undef,    );}sub init_instance {    my $self = shift;    confess("Internal error: max_doc is required")        unless defined $self->{max_doc};}# return a reference to a byte-array of normssub get_bytes {    my $self = shift;    $self->_ensure_read;    return \$self->{bytes};}# Lazily read in the raw array of norms.sub _ensure_read {    my $self = shift;    if ( !defined $self->{bytes} ) {        $self->{bytes} = $self->{instream}->lu_read( 'a' . $self->{max_doc} );    }}sub close { shift->{instream}->close }1;__END__=begin devdocs=head1 NAMEKinoSearch::Index::NormsReader - read field normalization data=head1 DESCRIPTIONNormsReader accesses the encoded norms which are built up, one byte perdocument, for indexed fields.=head1 SEE ALSOL<KinoSearch::Search::Similarity|KinoSearch::Search::Similarity>=head1 TODOMake "fake" norms possible, for fields where the norm is useless, like uniqueid fields.=head1 COPYRIGHTCopyright 2005-2007 Marvin Humphrey=head1 LICENSE, DISCLAIMER, BUGS, etc.See L<KinoSearch|KinoSearch> version 0.163.=end devdocs=cut

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?