line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
249005
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
380
|
|
2
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
301
|
|
3
|
9
|
|
|
9
|
|
53
|
use KinoSearch; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
695
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package KSx::Search::MockScorer; |
6
|
9
|
|
|
9
|
|
8697
|
BEGIN { our @ISA = qw( KSx::Search::MockMatcher ) } |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
3310
|
|
|
3310
|
1
|
131988
|
my ( $either, %args ) = @_; |
10
|
3310
|
50
|
|
|
|
11713
|
confess("Missing doc_ids") unless ref( $args{doc_ids} ) eq 'ARRAY'; |
11
|
3310
|
|
|
|
|
39514
|
my $doc_ids = KinoSearch::Object::I32Array->new( ints => $args{doc_ids} ); |
12
|
3310
|
|
|
|
|
12129
|
my $size = $doc_ids->get_size; |
13
|
3310
|
|
|
|
|
4566
|
my $scores; |
14
|
3310
|
100
|
|
|
|
13243
|
if ( ref( $args{scores} ) eq 'ARRAY' ) { |
15
|
3309
|
|
|
|
|
9104
|
confess("Mismatch between scores and doc_ids array sizes") |
16
|
3309
|
50
|
|
|
|
4631
|
unless scalar @{ $args{scores} } == $size; |
17
|
3309
|
|
|
|
|
39834
|
$scores = KinoSearch::Object::ByteBuf->new( |
18
|
3309
|
|
|
|
|
6984
|
pack( "f$size", @{ $args{scores} } ) ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
3310
|
|
|
|
|
41253
|
return $either->_new( |
22
|
|
|
|
|
|
|
doc_ids => $doc_ids, |
23
|
|
|
|
|
|
|
scores => $scores, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |