View | Details | Raw Unified | Return to bug 26683
Collapse All | Expand All

(-)a/Koha/Z3950Responder/GenericSession.pm (-1 lines)
Lines 26-32 use base qw( Koha::Z3950Responder::Session ); Link Here
26
use Koha::Logger;
26
use Koha::Logger;
27
use Koha::SearchEngine::Search;
27
use Koha::SearchEngine::Search;
28
use Koha::SearchEngine::QueryBuilder;
28
use Koha::SearchEngine::QueryBuilder;
29
use Koha::Z3950Responder::RPN;
30
29
31
=head1 NAME
30
=head1 NAME
32
31
(-)a/Makefile.PL (+1 lines)
Lines 340-345 my $target_map = { Link Here
340
  './koha-tmpl/opac-tmpl'       => {target => 'OPAC_TMPL_DIR', trimdir => -1},
340
  './koha-tmpl/opac-tmpl'       => {target => 'OPAC_TMPL_DIR', trimdir => -1},
341
  './kohaversion.pl'            => 'INTRANET_CGI_DIR',
341
  './kohaversion.pl'            => 'INTRANET_CGI_DIR',
342
  './labels'                    => 'INTRANET_CGI_DIR',
342
  './labels'                    => 'INTRANET_CGI_DIR',
343
  './Net'                       => 'PERL_MODULE_DIR',
343
  './mainpage.pl'               => 'INTRANET_CGI_DIR',
344
  './mainpage.pl'               => 'INTRANET_CGI_DIR',
344
  './Makefile.PL'               => 'NONE',
345
  './Makefile.PL'               => 'NONE',
345
  './MANIFEST.SKIP'             => 'NONE',
346
  './MANIFEST.SKIP'             => 'NONE',
(-)a/Net/Z3950/RPN/And.pm (+57 lines)
Line 0 Link Here
1
# Copyright The National Library of Finland 2018
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
package Net::Z3950::RPN::And;
19
20
use Modern::Perl;
21
our @ISA = qw(Net::Z3950::RPN::Node);
22
23
=head1 NAME
24
25
Net::Z3950::RPN::And
26
27
=cut
28
29
=head1 SYNOPSIS
30
31
Overrides for the C<Net::Z3950::RPN> classes adding a C<to_koha> method that
32
converts the query to a syntax that C<Koha::SearchEngine> understands.
33
34
=cut
35
36
=head1 DESCRIPTION
37
38
The previous method used is described in C<samples/render-search.pl> of
39
C<Net::Z3950::SimpleServer>, but Perl critic doesn't like it, so
40
we are using whole package overrides here.
41
42
=cut
43
44
=head2 to_koha
45
46
    Convert query to a syntax that C<Koha::SearchEngine> understands.
47
48
=cut
49
50
sub to_koha {
51
    my ($self, $mappings) = @_;
52
53
    return '(' . $self->[0]->to_koha($mappings) . ' AND ' .
54
                 $self->[1]->to_koha($mappings) . ')';
55
}
56
57
1;
(-)a/Net/Z3950/RPN/AndNot.pm (+53 lines)
Line 0 Link Here
1
# Copyright The National Library of Finland 2018
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
package Net::Z3950::RPN::AndNot;
19
20
use Modern::Perl;
21
our @ISA = qw(Net::Z3950::RPN::Node);
22
23
=head1 NAME
24
25
Net::Z3950::RPN::AndNot
26
27
=head1 SYNOPSIS
28
29
Overrides for the C<Net::Z3950::RPN> classes adding a C<to_koha> method that
30
converts the query to a syntax that C<Koha::SearchEngine> understands.
31
32
=head1 DESCRIPTION
33
34
The previous method used is described in C<samples/render-search.pl> of
35
C<Net::Z3950::SimpleServer>, but Perl critic doesn't like it, so
36
we are using whole package overrides here.
37
38
=cut
39
40
=head2 to_koha
41
42
    Convert query to a syntax that C<Koha::SearchEngine> understands.
43
44
=cut
45
46
sub to_koha {
47
    my ($self, $mappings) = @_;
48
49
    return '(' . $self->[0]->to_koha($mappings) . ' NOT ' .
50
                 $self->[1]->to_koha($mappings) . ')';
51
}
52
53
1;
(-)a/Net/Z3950/RPN/Or.pm (+53 lines)
Line 0 Link Here
1
# Copyright The National Library of Finland 2018
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
package Net::Z3950::RPN::Or;
19
20
use Modern::Perl;
21
our @ISA = qw(Net::Z3950::RPN::Node);
22
23
=head1 NAME
24
25
Net::Z3950::RPN::Or
26
27
=head1 SYNOPSIS
28
29
Overrides for the C<Net::Z3950::RPN> classes adding a C<to_koha> method that
30
converts the query to a syntax that C<Koha::SearchEngine> understands.
31
32
=head1 DESCRIPTION
33
34
The previous method used is described in C<samples/render-search.pl> of
35
C<Net::Z3950::SimpleServer>, but Perl critic doesn't like it, so
36
we are using whole package overrides here.
37
38
=cut
39
40
=head2 to_koha
41
42
    Convert query to a syntax that C<Koha::SearchEngine> understands.
43
44
=cut
45
46
sub to_koha {
47
    my ($self, $mappings) = @_;
48
49
    return '(' . $self->[0]->to_koha($mappings) . ' OR ' .
50
                 $self->[1]->to_koha($mappings) . ')';
51
}
52
53
1;
(-)a/Koha/Z3950Responder/RPN.pm (-31 / +19 lines)
Lines 1-5 Link Here
1
#!/usr/bin/perl
2
3
# Copyright The National Library of Finland 2018
1
# Copyright The National Library of Finland 2018
4
#
2
#
5
# This file is part of Koha.
3
# This file is part of Koha.
Lines 17-27 Link Here
17
# You should have received a copy of the GNU General Public License
15
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
17
18
package Net::Z3950::RPN::Term;
19
20
use Modern::Perl;
20
use Modern::Perl;
21
our @ISA = qw(Net::Z3950::RPN::Node);
21
22
22
=head1 NAME
23
=head1 NAME
23
24
24
Koha::Z3950Responder::RPN
25
Net::Z3950::RPN::Term
25
26
26
=head1 SYNOPSIS
27
=head1 SYNOPSIS
27
28
Lines 30-41 converts the query to a syntax that C<Koha::SearchEngine> understands. Link Here
30
31
31
=head1 DESCRIPTION
32
=head1 DESCRIPTION
32
33
33
The method used here is described in C<samples/render-search.pl> of
34
The previous method used is described in C<samples/render-search.pl> of
34
C<Net::Z3950::SimpleServer>.
35
C<Net::Z3950::SimpleServer>, but Perl critic doesn't like it, so
36
we are using whole package overrides here.
37
38
=cut
39
40
=head2 to_koha
41
42
    Convert query to a syntax that C<Koha::SearchEngine> understands.
35
43
36
=cut
44
=cut
37
45
38
package Net::Z3950::RPN::Term;
39
sub to_koha {
46
sub to_koha {
40
    my ($self, $mappings) = @_;
47
    my ($self, $mappings) = @_;
41
48
Lines 93-98 sub to_koha { Link Here
93
    return '(' . join(' OR ', @terms) . ')';
100
    return '(' . join(' OR ', @terms) . ')';
94
}
101
}
95
102
103
=head2 escape
104
105
    Escape the term
106
107
=cut
108
96
sub escape {
109
sub escape {
97
    my ($self, $term) = @_;
110
    my ($self, $term) = @_;
98
111
Lines 100-127 sub escape { Link Here
100
    return $term;
113
    return $term;
101
}
114
}
102
115
103
package Net::Z3950::RPN::And;
104
sub to_koha {
105
    my ($self, $mappings) = @_;
106
107
    return '(' . $self->[0]->to_koha($mappings) . ' AND ' .
108
                 $self->[1]->to_koha($mappings) . ')';
109
}
110
111
package Net::Z3950::RPN::Or;
112
sub to_koha {
113
    my ($self, $mappings) = @_;
114
115
    return '(' . $self->[0]->to_koha($mappings) . ' OR ' .
116
                 $self->[1]->to_koha($mappings) . ')';
117
}
118
119
package Net::Z3950::RPN::AndNot;
120
sub to_koha {
121
    my ($self, $mappings) = @_;
122
123
    return '(' . $self->[0]->to_koha($mappings) . ' NOT ' .
124
                 $self->[1]->to_koha($mappings) . ')';
125
}
126
127
1;
116
1;
128
- 

Return to bug 26683