line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Query::Field::Lucy; |
2
|
4
|
|
|
4
|
|
22
|
use Moo; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
24
|
|
3
|
|
|
|
|
|
|
extends 'Search::Query::Field'; |
4
|
4
|
|
|
4
|
|
1125
|
use Scalar::Util qw( blessed ); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
219
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
840
|
use namespace::autoclean; |
|
4
|
|
|
|
|
24351
|
|
|
4
|
|
|
|
|
39
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'type' => ( is => 'rw', default => sub {'char'} ); |
9
|
|
|
|
|
|
|
has 'is_int' => ( is => 'rw', default => sub {0} ); |
10
|
|
|
|
|
|
|
has 'analyzer' => ( is => 'rw' ); # TODO isa check |
11
|
|
|
|
|
|
|
has 'range_query_class' => |
12
|
|
|
|
|
|
|
( is => 'rw', default => sub {'Lucy::Search::RangeQuery'} ); |
13
|
|
|
|
|
|
|
has 'term_query_class' => |
14
|
|
|
|
|
|
|
( is => 'rw', default => sub {'Lucy::Search::TermQuery'} ); |
15
|
|
|
|
|
|
|
has 'phrase_query_class' => |
16
|
|
|
|
|
|
|
( is => 'rw', default => sub {'Lucy::Search::PhraseQuery'} ); |
17
|
|
|
|
|
|
|
has 'proximity_query_class' => |
18
|
|
|
|
|
|
|
( is => 'rw', default => sub {'LucyX::Search::ProximityQuery'} ); |
19
|
|
|
|
|
|
|
has 'wildcard_query_class' => |
20
|
|
|
|
|
|
|
( is => 'rw', default => sub {'LucyX::Search::WildcardQuery'} ); |
21
|
|
|
|
|
|
|
has 'nullterm_query_class' => |
22
|
|
|
|
|
|
|
( is => 'rw', default => sub {'LucyX::Search::NullTermQuery'} ); |
23
|
|
|
|
|
|
|
has 'anyterm_query_class' => |
24
|
|
|
|
|
|
|
( is => 'rw', default => sub {'LucyX::Search::AnyTermQuery'} ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.202'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Search::Query::Field::Lucy - query field representing a Lucy field |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $field = Search::Query::Field::Lucy->new( |
35
|
|
|
|
|
|
|
name => 'foo', |
36
|
|
|
|
|
|
|
alias_for => [qw( bar bing )], |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Search::Query::Field::Lucy implements field |
42
|
|
|
|
|
|
|
validation and aliasing in Lucy search queries. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This class is a subclass of Search::Query::Field. Only new or overridden |
47
|
|
|
|
|
|
|
methods are documented here. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 BUILD |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Available params are also standard attribute accessor methods. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item type |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The column type. This may be a Lucy::FieldType object |
58
|
|
|
|
|
|
|
or a simple string. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item is_int |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Set if C matches m/int|num|date/. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item analyzer |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Set to a L-based object (optional). |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item range_query_class |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Defaults to L. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item term_query_class |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Defaults to L. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item phrase_query_class |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Defaults to L. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item proximity_query_class |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Defaults to L. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item wildcard_query_class |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Defaults to L. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item nullterm_query_class |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Defaults to L. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item anyterm_query_class |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Defaults to L. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub BUILD { |
101
|
30
|
|
|
30
|
1
|
164
|
my $self = shift; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# numeric types |
104
|
30
|
100
|
33
|
|
|
398
|
if ( exists $self->{type} |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
105
|
|
|
|
|
|
|
&& defined $self->{type} |
106
|
|
|
|
|
|
|
&& !blessed( $self->{type} ) |
107
|
|
|
|
|
|
|
&& $self->{type} =~ m/int|date|num/ ) |
108
|
|
|
|
|
|
|
{ |
109
|
1
|
|
|
|
|
20
|
$self->{is_int} = 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# text types |
113
|
|
|
|
|
|
|
else { |
114
|
29
|
|
|
|
|
550
|
$self->{is_int} = 0; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |