line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Fulltext; |
2
|
4
|
|
|
4
|
|
104174
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
149
|
|
3
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
106
|
|
4
|
4
|
|
|
4
|
|
1106
|
use utf8; |
|
4
|
|
|
|
|
21
|
|
|
4
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
102
|
use Carp; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
550
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
9
|
4
|
|
|
4
|
|
2318
|
use Search::Fulltext::SQLite; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
847
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
6
|
|
|
6
|
1
|
4607
|
my ($class, @args) = @_; |
13
|
6
|
50
|
|
|
|
42
|
my %args = ref $args[0] eq 'HASH' ? %{$args[0]} : @args; |
|
6
|
|
|
|
|
39
|
|
14
|
|
|
|
|
|
|
|
15
|
6
|
50
|
|
|
|
35
|
unless ($args{docs}) { croak "'docs' is required for creating new instance of $class" } |
|
0
|
|
|
|
|
0
|
|
16
|
6
|
100
|
|
|
|
38
|
$args{index_file} = ":memory:" unless defined $args{index_file}; |
17
|
6
|
100
|
|
|
|
36
|
$args{tokenizer} = "simple" unless defined $args{tokenizer}; |
18
|
6
|
|
|
|
|
71
|
$args{sqliteh} = Search::Fulltext::SQLite::->new( |
19
|
|
|
|
|
|
|
docs => $args{docs}, |
20
|
|
|
|
|
|
|
dbfile => $args{index_file}, |
21
|
|
|
|
|
|
|
tokenizer => $args{tokenizer}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
80
|
bless { |
25
|
|
|
|
|
|
|
%args |
26
|
|
|
|
|
|
|
}, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub search { |
30
|
14
|
|
|
14
|
1
|
5180
|
my ($self, $query) = @_; |
31
|
14
|
50
|
|
|
|
48
|
return [] unless $query; |
32
|
|
|
|
|
|
|
|
33
|
14
|
|
|
|
|
42
|
my $sqliteh = $self->{sqliteh}; |
34
|
14
|
|
|
|
|
55
|
$sqliteh->search_docids($query); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |