line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package KinoSearch1::Search::QueryFilter; |
2
|
2
|
|
|
2
|
|
3102
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
81
|
|
3
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
13
|
use KinoSearch1::Util::ToolSet; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
309
|
|
5
|
2
|
|
|
2
|
|
13
|
use base qw( KinoSearch1::Util::Class ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
235
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
2
|
|
|
2
|
|
22
|
__PACKAGE__->init_instance_vars( |
9
|
|
|
|
|
|
|
# constructor params / members |
10
|
|
|
|
|
|
|
query => undef, |
11
|
|
|
|
|
|
|
# members |
12
|
|
|
|
|
|
|
cached_bits => undef, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
14
|
use KinoSearch1::Search::HitCollector; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
391
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init_instance { |
19
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
20
|
1
|
50
|
|
|
|
8
|
confess("required parameter query is not a KinoSearch1::Search::Query") |
21
|
|
|
|
|
|
|
unless a_isa_b( $self->{query}, 'KinoSearch1::Search::Query' ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub bits { |
25
|
1
|
|
|
1
|
0
|
19
|
my ( $self, $searcher ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# fill the cache |
28
|
1
|
50
|
|
|
|
6
|
if ( !defined $self->{cache} ) { |
29
|
1
|
|
|
|
|
4
|
my $collector = KinoSearch1::Search::BitCollector->new( |
30
|
|
|
|
|
|
|
capacity => $searcher->max_doc, ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# perform the search |
33
|
1
|
|
|
|
|
16
|
$searcher->search_hit_collector( |
34
|
|
|
|
|
|
|
weight => $self->{query}->to_weight($searcher), |
35
|
|
|
|
|
|
|
hit_collector => $collector, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# save the bitvector of doc hits |
39
|
1
|
|
|
|
|
28
|
$self->{cached_bits} = $collector->get_bit_vector; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
13
|
return $self->{cached_bits}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |