|
Lines 17-22
package Koha::SearchEngine::Zebra::QueryBuilder;
Link Here
|
| 17 |
# You should have received a copy of the GNU General Public License |
17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
|
|
20 |
=head1 NAME |
| 21 |
|
| 22 |
Koha::SearchEngine::Zebra::QueryBuilder - Zebra query objects from user-supplied queries |
| 23 |
Several methods are pass-throughs to C4 methods or other methods here |
| 24 |
|
| 25 |
=head1 DESCRIPTION |
| 26 |
|
| 27 |
This provides the functions that take a user-supplied search query, and |
| 28 |
provides something that can be given to Zebra to get answers. |
| 29 |
|
| 30 |
=head1 SYNOPSIS |
| 31 |
|
| 32 |
use Koha::SearchEngine::Zebra::QueryBuilder; |
| 33 |
$builder = Koha::SearchEngine::Zebra::QueryBuilder->new({ index => $index }); |
| 34 |
my $simple_query = $builder->build_query("hello"); |
| 35 |
|
| 36 |
=head1 METHODS |
| 37 |
|
| 38 |
=cut |
| 20 |
use Modern::Perl; |
39 |
use Modern::Perl; |
| 21 |
|
40 |
|
| 22 |
use base qw(Class::Accessor); |
41 |
use base qw(Class::Accessor); |
|
Lines 24-34
use base qw(Class::Accessor);
Link Here
|
| 24 |
use C4::Search; |
43 |
use C4::Search; |
| 25 |
use C4::AuthoritiesMarc; |
44 |
use C4::AuthoritiesMarc; |
| 26 |
|
45 |
|
|
|
46 |
=head2 build_query |
| 47 |
|
| 48 |
Pass-through to C4::Search::buildQuery |
| 49 |
|
| 50 |
=cut |
| 51 |
|
| 27 |
sub build_query { |
52 |
sub build_query { |
| 28 |
shift; |
53 |
shift; |
| 29 |
C4::Search::buildQuery @_; |
54 |
C4::Search::buildQuery @_; |
| 30 |
} |
55 |
} |
| 31 |
|
56 |
|
|
|
57 |
=head2 build_query_compat |
| 58 |
|
| 59 |
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type) = |
| 60 |
build_query_compat($operators, $operands, $indexes, $limits, $sort_by, $scan, $lang, $params) |
| 61 |
|
| 62 |
=cut |
| 63 |
|
| 32 |
sub build_query_compat { |
64 |
sub build_query_compat { |
| 33 |
my $self = shift; |
65 |
my $self = shift; |
| 34 |
my ($operators, $operands, $indexes, $limits, $sort_by, $scan, $lang, $params) = @_; |
66 |
my ($operators, $operands, $indexes, $limits, $sort_by, $scan, $lang, $params) = @_; |
|
Lines 55-60
sub build_query_compat {
Link Here
|
| 55 |
return ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type); |
87 |
return ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type); |
| 56 |
} |
88 |
} |
| 57 |
|
89 |
|
|
|
90 |
=head2 build_authorities_query |
| 91 |
|
| 92 |
my $query = build_authorities_query( \@query ); |
| 93 |
|
| 94 |
=cut |
| 95 |
|
| 58 |
sub build_authorities_query { |
96 |
sub build_authorities_query { |
| 59 |
shift; |
97 |
shift; |
| 60 |
return { |
98 |
return { |
|
Lines 68-73
sub build_authorities_query {
Link Here
|
| 68 |
}; |
106 |
}; |
| 69 |
} |
107 |
} |
| 70 |
|
108 |
|
|
|
109 |
=head2 build_authorities_query_compat |
| 110 |
|
| 111 |
Pass-through to build_authorities_query |
| 112 |
|
| 113 |
=cut |
| 114 |
|
| 71 |
sub build_authorities_query_compat { |
115 |
sub build_authorities_query_compat { |
| 72 |
# Pass straight through as well |
116 |
# Pass straight through as well |
| 73 |
build_authorities_query(@_); |
117 |
build_authorities_query(@_); |
| 74 |
- |
|
|