Plucene/Search/Searcher.pm

filter: Statementstmt 73.6% 14 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 100% 6 / 6 totaltotal 71.4% 25 / 35 CC 1 SCAR 4.1
CC
1
Cov
74%
doc_freq
2.0
max_doc
2.0
doc
2.0
CRAP 1.5
« Plucene/Index/SegmentTermPositions.pm ↑ Summary Plucene/Analysis/Tokenizer.pm »
1 package Plucene::Search::Searcher;
2  
3 =head1 NAME
4  
5 Plucene::Search::Searcher - base class for searchers
6  
7 =head1 DESCRIPTION
8  
9 Abstract base class for searchers.
10  
11 Searching is the operation of locating a subset of the documents that
12 contains desired content or that their attributes match some specification.
13  
14 The input for a search operation is a 'query' that specifies a criteria for
15 selecting the documents and its output is a list of documents ('hits') that
16 matched that criteria.
17  
18 The hit list is typically ordered by some measure of relevancy (called
19 'ranking' or 'scoring') and may contain only a subset of the set of documents
20 that matched the query (typically the ones with the highest scored documents).
21  
22 The search operation is performed on an 'index' which is a specialized
23 database that contains a pre compiled information of the document set.
24 The index database is optimized for locating quickly documents that contains
25 certain words or terms.
26  
27 =head1 METHODS
28  
29 =cut
30  
31 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 16 ▶use Plucene::Search::Hits;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 =head2 doc_freq / max_doc / doc / _search_hc search_top
37  
38 These must be defined in a subclas
39  
40 =cut
41  
42 0 ▶sub doc_freq { die "doc_freq must be defined in a subclass" }
Subroutine doc_freq: not called CC=1 SCAR=6.9
Pod documented
43 0 ▶sub max_doc { die "max_doc must be defined in a subclass" }
Subroutine max_doc: not called CC=1 SCAR=6.9
Pod documented
44 0 ▶sub doc { die "doc must be defined in a subclass" }
Subroutine doc: not called CC=1 SCAR=6.9
Pod documented
45 0 ▶sub _search_hc { die "_search_hc must be defined in a subclass" }
Subroutine _search_hc: not called CC=1 SCAR=6.9
46 0 ▶sub search_top { die "search_top must be defined in a subclass" }
Subroutine search_top: not called CC=1 SCAR=6.9
Pod documented
47  
48 =head2 search
49  
50 my Plucene::Search::Hits $hits = $searcher->new($query, $filter);
51  
52 This will return the Plucene::Search::Hits object for the passed in query
53 and filter. At this stage, filter is optional.
54  
55 =cut
56  
57 189 ▶sub search {
Subroutine search: called CC=1 SCAR=0.0
Pod documented
58 189 my ($self, $query, $filter) = @_;
59  
60 # $filter may be undefined, that's OK
61 189 return Plucene::Search::Hits->new({
62 searcher => $self,
63 query => $query,
64 filter => $filter
65 });
66 }
67  
68 =head2 search_hc
69  
70 =cut
71  
72 2 ▶sub search_hc {
Subroutine search_hc: called CC=1 SCAR=0.0
Pod documented
73 2 my ($self, $query, $hc) = @_;
74 2 $self->_search_hc($query, undef, $hc);
75 }
76  
77 16 1;
« Plucene/Index/SegmentTermPositions.pm ↑ Summary Plucene/Analysis/Tokenizer.pm »