File Coverage

blib/lib/Dezi/Searcher/SearchOpts.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Dezi::Searcher::SearchOpts;
2 3     3   16 use Moose;
  3         8  
  3         25  
3             with 'Dezi::Role';
4 3     3   21319 use Carp;
  3         8  
  3         225  
5 3     3   20 use Types::Standard qw( Int ArrayRef Str Maybe );
  3         6  
  3         26  
6 3     3   3612 use namespace::autoclean;
  3         9440  
  3         29  
7              
8             our $VERSION = '0.014';
9              
10             has 'start' => (
11             is => 'rw',
12             isa => Int,
13             lazy => 1,
14             default => sub {0}
15             );
16             has 'max' => (
17             is => 'rw',
18             isa => Maybe [Int],
19             lazy => 1,
20             default => sub {1000},
21             );
22             has 'order' => ( is => 'rw' ); # search() must handle isa
23             has 'limit' => ( is => 'rw', isa => ArrayRef );
24             has 'default_boolop' => (
25             is => 'rw',
26             isa => Str,
27             lazy => 1,
28             default => sub {'AND'}
29             );
30              
31             __PACKAGE__->meta->make_immutable;
32              
33             1;
34              
35             __END__
36              
37             =head1 NAME
38              
39             Dezi::Searcher::SearchOpts - options for the Dezi::Searcher->search method
40              
41             =head1 SYNOPSIS
42              
43             use Dezi::Searcher;
44             my $searcher = Dezi::Searcher->new();
45             my $results = $searcher->search( 'foo bar', {
46             start => 0,
47             max => 1000,
48             order => 'title DESC',
49             limit => [ [qw( lastmod 100000 200000 )] ],
50             default_boolop => 'AND',
51             });
52             my $opts = $results->opts; # isa Dezi::Searcher::SearchOpts
53              
54             =head1 METHODS
55              
56             The following attributes are defined.
57              
58             =over
59              
60             =item start
61              
62             The starting position. Default is 0.
63              
64             =item max
65              
66             The ending position. Default is max_hits() as documented
67             in Dezi::Searcher.
68              
69             =item order
70              
71             Takes a SQL-like text string (parse-able by L<Sort::SQL>),
72             or an object defined by the Searcher class, which will determine the sort order.
73              
74             =item limit
75              
76             Takes an arrayref of arrayrefs. Each child arrayref should
77             have three values: a field (PropertyName) value, a lower limit
78             and an upper limit.
79              
80             =item default_boolop
81              
82             The default boolean connector for parsing I<query>. Valid values
83             are B<AND> and B<OR>. The default is
84             B<AND> (which is different than Lucy::QueryParser, but the
85             same as Swish-e).
86              
87             =back
88              
89             =head1 AUTHOR
90              
91             Peter Karman, E<lt>karpet@dezi.orgE<gt>
92              
93             =head1 BUGS
94              
95             Please report any bugs or feature requests to C<bug-dezi-app at rt.cpan.org>, or through
96             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-App>.
97             I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
98              
99             =head1 SUPPORT
100              
101             You can find documentation for this module with the perldoc command.
102              
103             perldoc Dezi::Searcher::SearchOpts
104              
105             You can also look for information at:
106              
107             =over 4
108              
109             =item * Website
110              
111             L<http://dezi.org/>
112              
113             =item * IRC
114              
115             #dezisearch at freenode
116              
117             =item * Mailing list
118              
119             L<https://groups.google.com/forum/#!forum/dezi-search>
120              
121             =item * RT: CPAN's request tracker
122              
123             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dezi-App>
124              
125             =item * AnnoCPAN: Annotated CPAN documentation
126              
127             L<http://annocpan.org/dist/Dezi-App>
128              
129             =item * CPAN Ratings
130              
131             L<http://cpanratings.perl.org/d/Dezi-App>
132              
133             =item * Search CPAN
134              
135             L<https://metacpan.org/dist/Dezi-App/>
136              
137             =back
138              
139             =head1 COPYRIGHT AND LICENSE
140              
141             Copyright 2014 by Peter Karman
142              
143             This library is free software; you can redistribute it and/or modify
144             it under the terms of the GPL v2 or later.
145              
146             =head1 SEE ALSO
147              
148             L<http://dezi.org/>, L<http://swish-e.org/>, L<http://lucy.apache.org/>