Lucy/Result.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Lucy/Indexer.pm ↑ Summary Lucy/Results.pm »
1 package SWISH::Prog::Lucy::Result;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 our $VERSION = '0.25';
6  
7 1 ▶use base qw( SWISH::Prog::Result );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 0 ▶use SWISH::3 ':constants';
Subroutine BEGIN: called CC=1 SCAR=2.6
9 use Carp;
10  
11 __PACKAGE__->mk_accessors(qw( id relevant_fields property_map ));
12  
13 =head1 NAME
14  
15 SWISH::Prog::Lucy::Result - search result for Swish3 Apache Lucy backend
16  
17 =head1 SYNOPSIS
18  
19 # see SWISH::Prog::Result
20  
21 =head1 DESCRIPTION
22  
23 SWISH::Prog::Lucy::Result is an Apache Lucy based Result
24 class for Swish3.
25  
26 =head1 METHODS
27  
28 Only new and overridden methods are documented here. See
29 the L<SWISH::Prog::Result> documentation.
30  
31 =head2 relevant_fields
32  
33 Returns an ARRAY ref of the field names in the result
34 that matched the query. Will only be populated if
35 the Results object had find_relevant_fields() set to true.
36  
37 =cut
38  
39 =head2 uri
40  
41 Returns the uri (unique term) for the result document.
42  
43 =cut
44  
45 sub uri { $_[0]->{doc}->{swishdocpath} }
46  
47 =head2 title
48  
49 Returns the title of the result document.
50  
51 =cut
52  
53 sub title { $_[0]->{doc}->{swishtitle} }
54  
55 =head2 mtime
56  
57 Returns the last modified time of the result document.
58  
59 =cut
60  
61 sub mtime { $_[0]->{doc}->{swishlastmodified} }
62  
63 =head2 summary
64  
65 Returns the swishdescription of the result document.
66  
67 =cut
68  
69 sub summary { $_[0]->{doc}->{swishdescription} }
70  
71 =head2 get_property( I<PropertyName> )
72  
73 Returns the value for I<PropertyName>.
74  
75 =cut
76  
77 sub get_property {
78 my $self = shift;
79 my $propname = shift or croak "PropertyName required";
80  
81 # if $propname is an alias, use the real property name (how it is stored)
82 if ( exists $self->{property_map}->{$propname} ) {
83 $propname = $self->{property_map}->{$propname};
84 }
85  
86 if ( !exists $self->{doc}->{$propname} ) {
87 croak "no such PropertyName: $propname";
88 }
89 return $self->{doc}->{$propname};
90 }
91  
92 =head2 property_map
93  
94 Get the read-only hashref of PropertyNameAlias to PropertyName
95 values.
96  
97 =head2 id
98  
99 Get the read-only unique id from parent Searcher.
100  
101 =cut
102  
103 1;
104  
105 __END__
« Lucy/Indexer.pm ↑ Summary Lucy/Results.pm »