Filename | /usr/share/koha/lib/Koha/QueryParser/Driver/PQF/query_plan/node.pm |
Statements | Executed 10 statements in 585µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 46µs | 205µs | BEGIN@2 | Koha::QueryParser::Driver::PQF::query_plan::node::
1 | 1 | 1 | 13µs | 17µs | BEGIN@4 | Koha::QueryParser::Driver::PQF::query_plan::node::
1 | 1 | 1 | 11µs | 23µs | BEGIN@5 | Koha::QueryParser::Driver::PQF::query_plan::node::
0 | 0 | 0 | 0s | 0s | target_syntax | Koha::QueryParser::Driver::PQF::query_plan::node::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Koha::QueryParser::Driver::PQF::query_plan::node; | ||||
2 | 3 | 42µs | 2 | 363µs | # spent 205µs (46+158) within Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@2 which was called:
# once (46µs+158µs) by Koha::QueryParser::Driver::PQF::BEGIN@13 at line 2 # spent 205µs making 1 call to Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@2
# spent 158µs making 1 call to base::import |
3 | |||||
4 | 3 | 26µs | 2 | 21µs | # spent 17µs (13+4) within Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@4 which was called:
# once (13µs+4µs) by Koha::QueryParser::Driver::PQF::BEGIN@13 at line 4 # spent 17µs making 1 call to Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@4
# spent 4µs making 1 call to strict::import |
5 | 3 | 514µs | 2 | 36µs | # spent 23µs (11+13) within Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@5 which was called:
# once (11µs+13µs) by Koha::QueryParser::Driver::PQF::BEGIN@13 at line 5 # spent 23µs making 1 call to Koha::QueryParser::Driver::PQF::query_plan::node::BEGIN@5
# spent 13µs making 1 call to warnings::import |
6 | |||||
7 | =head1 NAME | ||||
8 | |||||
- - | |||||
21 | sub target_syntax { | ||||
22 | my ($self, $server) = @_; | ||||
23 | my $pqf = ''; | ||||
24 | my $atom_content; | ||||
25 | my $atom_count = 0; | ||||
26 | my @fields = (); | ||||
27 | my $fieldobj; | ||||
28 | my $relbump; | ||||
29 | |||||
30 | if (scalar(@{$self->fields})) { | ||||
31 | foreach my $field (@{$self->fields}) { | ||||
32 | $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $self->classname, $field, $server); | ||||
33 | $relbump = $self->plan->QueryParser->bib1_mapping_by_name('relevance_bump', $self->classname, $field, $server); | ||||
34 | if ($relbump) { | ||||
35 | $fieldobj->{'attr_string'} .= ' ' . $relbump->{'attr_string'}; | ||||
36 | } | ||||
37 | push @fields, $fieldobj unless (!defined($fieldobj) || ($field eq $self->classname && @{$self->fields} > 1)); | ||||
38 | } | ||||
39 | } else { | ||||
40 | $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $self->classname, $self->classname, $server); | ||||
41 | my $relbumps = $self->plan->QueryParser->bib1_mapping_by_name('relevance_bump', $self->classname, '', $server); | ||||
42 | push @fields, $fieldobj; | ||||
43 | if ($relbumps) { | ||||
44 | foreach my $field (keys %$relbumps) { | ||||
45 | $relbump = $relbumps->{$field}; | ||||
46 | $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $relbump->{'classname'}, $relbump->{'field'}, $server); | ||||
47 | $fieldobj->{'attr_string'} ||= ''; | ||||
48 | $fieldobj->{'attr_string'} .= ' ' . $relbump->{$server}{'attr_string'} if $relbump->{$server}{'attr_string'}; | ||||
49 | push @fields, $fieldobj; | ||||
50 | } | ||||
51 | } | ||||
52 | } | ||||
53 | |||||
54 | if (@{$self->phrases}) { | ||||
55 | foreach my $phrase (@{$self->phrases}) { | ||||
56 | if ($phrase) { | ||||
57 | $phrase =~ s/"/\\"/g; | ||||
58 | $pqf .= ' @or ' x (scalar(@fields) - 1); | ||||
59 | foreach my $attributes (@fields) { | ||||
60 | $attributes->{'attr_string'} ||= ''; | ||||
61 | $pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=1') . ' "' . $phrase . '" '; | ||||
62 | } | ||||
63 | $atom_count++; | ||||
64 | } | ||||
65 | } | ||||
66 | } else { | ||||
67 | foreach my $atom (@{$self->query_atoms}) { | ||||
68 | if (ref($atom)) { | ||||
69 | $atom_content = $atom->target_syntax($server); | ||||
70 | if ($atom_content) { | ||||
71 | $pqf .= ' @or ' x (scalar(@fields) - 1); | ||||
72 | foreach my $attributes (@fields) { | ||||
73 | $attributes->{'attr_string'} ||= ''; | ||||
74 | if ($self->plan->QueryParser->custom_data->{'QueryAutoTruncate'} || $atom->suffix eq '*') { | ||||
75 | $attributes->{'attr_string'} .= ($attributes->{'5'} ? '' : ' @attr 5=1 '); | ||||
76 | } | ||||
77 | $pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=6 ') . $atom_content . ' '; | ||||
78 | } | ||||
79 | $atom_count++; | ||||
80 | } | ||||
81 | } | ||||
82 | } | ||||
83 | } | ||||
84 | $pqf = (OpenILS::QueryParser::_util::default_joiner eq '|' ? ' @or ' : ' @and ') x ($atom_count - 1) . $pqf; | ||||
85 | return ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $pqf; | ||||
86 | } | ||||
87 | |||||
88 | 1 | 3µs | 1; |