Fulltext.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 91.8% 45 / 49 CC 6 SCAR 10.6
CC
6
Cov
90%
new
5.1
search
2.0
BEGIN
1.0
CRAP 2.9
↑ Summary Fulltext/SQLite.pm »
1 package Search::Fulltext;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 our $VERSION = '1.03';
9 4 ▶use Search::Fulltext::SQLite;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 ▶sub new {
Subroutine new: called CC=5 SCAR=16.4
Pod documented
12 6 my ($class, @args) = @_;
13 6 ▶ my %args = ref $args[0] eq 'HASH' ? %{$args[0]} : @args;
Branch: 1 branch
BranchTrueFalseTotal
ref $args[0] eq 'HASH' ? : 6 0 6
14  
15 0 ▶ unless ($args{docs}) { croak "'docs' is required for creating new instance of $class" }
Branch: 1 branch
BranchTrueFalseTotal
unless ($args{"docs"}) 0 6 6
16 6 ▶ $args{index_file} = ":memory:" unless defined $args{index_file};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"index_file"} 5 1 6
17 6 ▶ $args{tokenizer} = "simple" unless defined $args{tokenizer};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"tokenizer"} 3 3 6
18 $args{sqliteh} = Search::Fulltext::SQLite::->new(
19 docs => $args{docs},
20 dbfile => $args{index_file},
21 tokenizer => $args{tokenizer},
22 6 );
23  
24 6 bless {
25 %args
26 }, $class;
27 }
28  
29 14 ▶sub search {
Subroutine search: called CC=2 SCAR=7.0
Pod documented
30 14 my ($self, $query) = @_;
31 14 ▶ return [] unless $query;
Branch: 1 branch
BranchTrueFalseTotal
unless $query 0 14 14
32  
33 14 my $sqliteh = $self->{sqliteh};
34 14 $sqliteh->search_docids($query);
35 }
36  
37 4 1;
38 __END__
↑ Summary Fulltext/SQLite.pm »