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

(-)a/Koha/QueryParser/Driver/PQF.pm (+849 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF;
2
use base qw(OpenILS::QueryParser Class::Accessor);
3
4
use strict;
5
use warnings;
6
7
use Module::Load::Conditional qw(can_load);
8
use Koha::QueryParser::Driver::PQF::Util;
9
use Koha::QueryParser::Driver::PQF::query_plan;
10
use Koha::QueryParser::Driver::PQF::query_plan::facet;
11
use Koha::QueryParser::Driver::PQF::query_plan::filter;
12
use Koha::QueryParser::Driver::PQF::query_plan::modifier;
13
use Koha::QueryParser::Driver::PQF::query_plan::node;
14
use Koha::QueryParser::Driver::PQF::query_plan::node::atom;
15
use Koha::QueryParser::Driver::PQF::query_plan::node::atom;
16
17
18
=head1 NAME
19
20
Koha::QueryParser::Driver::PQF - QueryParser driver for PQF
21
22
=head1 SYNOPSIS
23
24
    use Koha::QueryParser::Driver::PQF;
25
    my $QParser = Koha::QueryParser::Driver::PQF->new(%args);
26
27
=head1 DESCRIPTION
28
29
Main entrypoint into the QueryParser PQF driver. PQF is the Prefix Query
30
Language, the syntax used to serialize Z39.50 queries.
31
32
=head1 ACCESSORS
33
34
In order to simplify Bib-1 attribute mapping, this driver uses Class::Accessor
35
for accessing the following maps:
36
37
=over 4
38
39
=item B<bib1_field_map> - search class/field Bib-1 mappings
40
41
=item B<bib1_modifier_map> - search modifier mappings
42
43
=item B<bib1_filter_map> - search filter mappings
44
45
=item B<bib1_relevance_bump_map> - relevance bump mappings
46
47
=back
48
49
=cut
50
51
__PACKAGE__->mk_accessors(qw(bib1_field_map bib1_modifier_map bib1_filter_map bib1_relevance_bump_map));
52
53
=head1 FUNCTIONS
54
55
=cut
56
57
=head2 get
58
59
Overridden accessor method for Class::Accessor. (Do not call directly)
60
61
=cut
62
63
sub get {
64
    my $self = shift;
65
    return $self->_map(@_);
66
}
67
68
=head2 set
69
70
Overridden mutator method for Class::Accessor. (Do not call directly)
71
72
=cut
73
74
sub set {
75
    my $self = shift;
76
    return $self->_map(@_);
77
}
78
79
=head2 add_bib1_field_map
80
81
    $QParser->add_bib1_field_map($class => $field => $server => \%attributes);
82
83
    $QParser->add_bib1_field_map('author' => 'personal' => 'biblioserver' =>
84
                                    { '1' => '1003' });
85
86
Adds a search field<->bib1 attribute mapping for the specified server. The
87
%attributes hash contains maps Bib-1 Attributes to the appropropriate
88
values. Not all attributes must be specified.
89
90
=cut
91
92
sub add_bib1_field_map {
93
    my ($self, $class, $field, $server, $attributes) = @_;
94
95
    $self->add_search_field( $class => $field );
96
    $self->add_search_field_alias( $class => $field => $field );
97
    return $self->_add_field_mapping($self->bib1_field_map, $class, $field, $server, $attributes);
98
}
99
100
=head2 add_bib1_modifier_map
101
102
    $QParser->add_bib1_modifier_map($name => $server => \%attributes);
103
104
    $QParser->add_bib1_modifier_map('ascending' => 'biblioserver' =>
105
                                    { '7' => '1' });
106
107
Adds a search modifier<->bib1 attribute mapping for the specified server. The
108
%attributes hash contains maps Bib-1 Attributes to the appropropriate
109
values. Not all attributes must be specified.
110
111
=cut
112
113
sub add_bib1_modifier_map {
114
    my ($self, $name, $server, $attributes) = @_;
115
116
    $self->add_search_modifier( $name );
117
118
    return $self->_add_mapping($self->bib1_modifier_map, $name, $server, $attributes);
119
}
120
121
=head2 add_bib1_filter_map
122
123
    $QParser->add_bib1_filter_map($name => $server => \%attributes);
124
125
    $QParser->add_bib1_filter_map('date' => 'biblioserver' =>
126
                                    { 'callback' => &_my_callback });
127
128
Adds a search filter<->bib1 attribute mapping for the specified server. The
129
%attributes hash maps Bib-1 Attributes to the appropropriate values and
130
provides a callback for the filter. Not all attributes must be specified.
131
132
=cut
133
134
sub add_bib1_filter_map {
135
    my ($self, $name, $server, $attributes) = @_;
136
137
    $self->add_search_filter( $name, $attributes->{'callback'} );
138
139
    return $self->_add_mapping($self->bib1_filter_map, $server, $name, $attributes);
140
}
141
142
=head2 add_relevance_bump
143
144
    $QParser->add_relevance_bump($class, $field, $server, $multiplier, $active);
145
    $QParser->add_relevance_bump('title' => 'exact' => 'biblioserver' => 34, 1);
146
147
Add a relevance bump to the specified field. When searching for a class without
148
any fields, all the relevance bumps for the specified class will be 'OR'ed
149
together.
150
151
=cut
152
153
sub add_relevance_bump {
154
    my ($self, $class, $field, $server, $multiplier, $active) = @_;
155
    my $attributes = { '9' => $multiplier, '2' => '102', 'active' => $active };
156
157
    $self->add_search_field( $class => $field );
158
    return $self->_add_field_mapping($self->bib1_relevance_bump_map, $class, $field, $server, $attributes);
159
}
160
161
162
=head2 target_syntax
163
164
    my $pqf = $QParser->target_syntax($server, [$query]);
165
    my $pqf = $QParser->target_syntax('biblioserver', 'author|personal:smith');
166
    print $pqf; # assuming all the indexes are configured,
167
                # prints '@attr 1=1003 @attr 4=6 "smith"'
168
169
Transforms the current or specified query into a PQF query string for the
170
specified server.
171
172
=cut
173
174
sub target_syntax {
175
    my ($self, $server, $query) = @_;
176
    my $pqf = '';
177
    $self->parse($query) if $query;
178
    warn "QP query for $server: " . $self->query . "\n" if $self->debug;
179
    $pqf = $self->parse_tree->target_syntax($server);
180
    warn "PQF query: $pqf\n" if $self->debug;
181
    return $pqf;
182
}
183
184
=head2 date_filter_target_callback
185
186
    $QParser->add_bib1_filter_map($server, { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => 'pubdate' });
187
188
Callback for date filters. Note that although the first argument is the QParser
189
object, this is technically not an object-oriented routine. This has no
190
real-world implications.
191
192
=cut
193
194
sub date_filter_target_callback {
195
    my ($QParser, $filter, $params, $negate, $server) = @_;
196
    my $attr_string = $QParser->bib1_mapping_by_name( 'filter', $server, $filter )->{'attr_string'};
197
    my $pqf = '';
198
    foreach my $datespec (@$params) {
199
        my $datepqf = '';
200
        if ($datespec) {
201
            if ($datespec =~ m/(.*)-(.*)/) {
202
                if ($1) {
203
                    $datepqf .= $attr_string . ' @attr 2=4 "' . $1 . '"';
204
                }
205
                if ($2) {
206
                    $datepqf .= $attr_string . ' @attr 2=2 "' . $2 . '"';
207
                    $datepqf = '@and ' . $datepqf if $1;
208
                }
209
            } else {
210
                $datepqf .= $attr_string . ' "' . $datespec . '"';
211
            }
212
        }
213
        $pqf = ' @or ' . ($negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $pqf if $pqf;
214
        $pqf .= $datepqf;
215
    }
216
    return $pqf;
217
}
218
219
=head2 _map
220
221
    return $self->_map('bib1_field_map', $map);
222
223
Retrieves or sets a map.
224
225
=cut
226
227
sub _map {
228
    my ($self, $name, $map) = @_;
229
    $self->custom_data->{$name} ||= {};
230
    $self->custom_data->{$name} = $map if ($map);
231
    return $self->custom_data->{$name};
232
}
233
234
=head2 _add_mapping
235
236
    return $self->_add_mapping($map, $name, $server, $attributes)
237
238
Adds a mapping. Note that this is not used for mappings relating to fields.
239
240
=cut
241
242
sub _add_mapping {
243
    my ($self, $map, $name, $server, $attributes) = @_;
244
245
    my $attr_string = Koha::QueryParser::Driver::PQF::Util::attributes_to_attr_string($attributes);
246
    $attributes->{'attr_string'} = $attr_string;
247
248
    $map->{'by_name'}{$name}{$server} = $attributes;
249
    $map->{'by_attr'}{$server}{$attr_string} = { 'name' => $name, %$attributes };
250
251
    return $map;
252
}
253
254
=head2 _add_field_mapping
255
256
    return $self->_add_field_mapping($map, $class, $field, $server, $attributes)
257
258
Adds a mapping for field-related data.
259
260
=cut
261
262
sub _add_field_mapping {
263
    my ($self, $map, $class, $field, $server, $attributes) = @_;
264
    my $attr_string = Koha::QueryParser::Driver::PQF::Util::attributes_to_attr_string($attributes);
265
    $attributes->{'attr_string'} = $attr_string;
266
267
    $map->{'by_name'}{$class}{$field}{$server} = $attributes;
268
    $map->{'by_attr'}{$server}{$attr_string} = { 'classname' => $class, 'field' => $field, %$attributes };
269
    return $map;
270
}
271
272
273
=head2 bib1_mapping_by_name
274
275
    my $attributes = $QParser->bib1_mapping_by_name($type, $name[, $subname], $server);
276
    my $attributes = $QParser->bib1_mapping_by_name('field', 'author', 'personal', 'biblioserver');
277
    my $attributes = $QParser->bib1_mapping_by_name('filter', 'pubdate', 'biblioserver');
278
279
Retrieve the Bib-1 attribute set associated with the specified mapping.
280
=cut
281
282
sub bib1_mapping_by_name {
283
    my $server = pop;
284
    my ($self, $type, $name, $field) = @_;
285
286
    return unless ($server && $name);
287
    return unless ($type eq 'field' || $type eq 'modifier' || $type eq 'filter' || $type eq 'relevance_bump');
288
    if ($type eq 'field') {
289
    # Unfortunately field is a special case thanks to the class->field hierarchy
290
        return $self->_map('bib1_' . $type . '_map')->{'by_name'}{$name}{$field}{$server};
291
    } else {
292
        return $self->_map('bib1_' . $type . '_map')->{'by_name'}{$name}{$server};
293
    }
294
}
295
296
=head2 bib1_mapping_by_attr
297
298
    my $field = $QParser->bib1_mapping_by_attr($type, $server, \%attr);
299
    my $field = $QParser->bib1_mapping_by_attr('field', 'biblioserver', {'1' => '1003'});
300
    print $field->{'classname'}; # prints "author"
301
    print $field->{'field'}; # prints "personal"
302
303
Retrieve the search field/modifier/filter used for the specified Bib-1 attribute set.
304
305
=cut
306
307
sub bib1_mapping_by_attr {
308
    my ($self, $type, $server, $attributes) = @_;
309
    return unless ($server && $attributes);
310
311
    my $attr_string = Koha::QueryParser::Driver::PQF::Util::attributes_to_attr_string($attributes);
312
313
    return $self->bib1_mapping_by_attr_string($type, $server, $attr_string);
314
}
315
316
=head2 bib1_mapping_by_attr_string
317
318
    my $field = $QParser->bib1_mapping_by_attr_string($type, $server, $attr_string);
319
    my $field = $QParser->bib1_mapping_by_attr_string('field', 'biblioserver', '@attr 1=1003');
320
    print $field->{'classname'}; # prints "author"
321
    print $field->{'field'}; # prints "personal"
322
323
Retrieve the search field/modifier/filter used for the specified Bib-1 attribute string
324
(i.e. PQF snippet).
325
326
=cut
327
328
sub bib1_mapping_by_attr_string {
329
    my ($self, $type, $server, $attr_string) = @_;
330
    return unless ($server && $attr_string);
331
    return unless ($type eq 'field' || $type eq 'modifier' || $type eq 'filter' || $type eq 'relevance_bump');
332
333
    return $self->_map('bib1_' . $type . '_map')->{'by_attr'}{$server}{$attr_string};
334
}
335
336
337
=head2 _canonicalize_field_map
338
339
Convert a field map into its canonical form for serialization. Used only for
340
fields and relevance bumps.
341
342
=cut
343
344
sub _canonicalize_field_map {
345
    my ( $map, $aliases ) = @_;
346
    my $canonical_map = {};
347
348
    foreach my $class ( keys %{ $map->{'by_name'} } ) {
349
        $canonical_map->{$class} ||= {};
350
        foreach my $field ( keys %{ $map->{'by_name'}->{$class} } ) {
351
            my $field_map = {
352
                'index'   => $field,
353
                'label'   => ucfirst($field),
354
                'enabled' => '1',
355
            };
356
            foreach
357
              my $server ( keys %{ $map->{'by_name'}->{$class}->{$field} } )
358
            {
359
                $field_map->{'bib1_mapping'} ||= {};
360
                $field_map->{'bib1_mapping'}->{$server} =
361
                  $map->{'by_name'}->{$class}->{$field}->{$server};
362
                delete $field_map->{'bib1_mapping'}->{$server}->{'attr_string'}
363
                  if defined(
364
                          $field_map->{'bib1_mapping'}->{$server}
365
                            ->{'attr_string'}
366
                  );
367
            }
368
            if ($aliases) {
369
                $field_map->{'aliases'} = [];
370
                foreach my $alias ( @{ $aliases->{$class}->{$field} } ) {
371
                    push @{ $field_map->{$class}->{$field}->{'aliases'} },
372
                      $alias;
373
                }
374
            }
375
            $canonical_map->{$class}->{$field} = $field_map;
376
        }
377
    }
378
    return $canonical_map;
379
}
380
381
=head2 _canonicalize_map
382
383
Convert a map into its canonical form for serialization. Not used for fields.
384
385
=cut
386
387
sub _canonicalize_map {
388
    my ($map) = @_;
389
    my $canonical_map = {};
390
391
    foreach my $name ( keys %{ $map->{'by_name'} } ) {
392
        $canonical_map->{$name} = {
393
            'label'        => ucfirst($name),
394
            'enabled'      => 1,
395
            'bib1_mapping' => {}
396
        };
397
        foreach my $server ( keys %{ $map->{'by_name'}->{$name} } ) {
398
            $canonical_map->{$name}->{'bib1_mapping'}->{$server} =
399
              $map->{'by_name'}->{$name}->{$server};
400
            delete $canonical_map->{$name}->{'bib1_mapping'}->{$server}
401
              ->{'attr_string'}
402
              if defined(
403
                      $canonical_map->{$name}->{'bib1_mapping'}->{$server}
404
                        ->{'attr_string'}
405
              );
406
        }
407
    }
408
    return $canonical_map;
409
}
410
411
=head2 serialize_mappings
412
413
    my $yaml = $QParser->serialize_mappings;
414
    my $json = $QParser->serialze_mappings('json');
415
416
Serialize Bib-1 mappings to YAML or JSON.
417
418
=cut
419
420
sub serialize_mappings {
421
    my ( $self, $format ) = @_;
422
    $format ||= 'yaml';
423
    my $config;
424
425
    $config->{'field_mappings'} =
426
      _canonicalize_field_map( $self->bib1_field_map,
427
        $self->search_field_aliases );
428
    $config->{'modifier_mappings'} =
429
      _canonicalize_map( $self->bib1_modifier_map );
430
    $config->{'filter_mappings'} = _canonicalize_map( $self->bib1_filter_map );
431
    $config->{'relevance_bumps'} =
432
      _canonicalize_field_map( $self->bib1_relevance_bump_map );
433
434
    if ( $format eq 'json' && can_load( modules => { 'JSON' => undef } ) ) {
435
        return JSON::to_json($config);
436
    }
437
    elsif ( can_load( modules => { 'YAML::Any' => undef } ) ) {
438
        return YAML::Any::Dump($config);
439
    }
440
    return;
441
}
442
443
=head2 initialize
444
445
    $QParser->initialize( { 'bib1_field_mappings' => \%bib1_field_mappings,
446
                            'search_field_alias_mappings' => \%search_field_alias_mappings,
447
                            'bib1_modifier_mappings' => \%bib1_modifier_mappings,
448
                            'bib1_filter_mappings' => \%bib1_filter_mappings,
449
                            'relevance_bumps' => \%relevance_bumps });
450
451
Initialize the QueryParser mapping tables based on the provided configuration.
452
This method was written to play nice with YAML configuration files loaded by load_config.
453
454
=cut
455
456
sub initialize {
457
    my ( $self, $args ) = @_;
458
459
    my $field_mappings    = $args->{'field_mappings'};
460
    my $modifier_mappings = $args->{'modifier_mappings'};
461
    my $filter_mappings   = $args->{'filter_mappings'};
462
    my $relbumps          = $args->{'relevance_bumps'};
463
    my ( $server, $bib1_mapping );
464
    foreach my $class ( keys %$field_mappings ) {
465
        foreach my $field ( keys %{ $field_mappings->{$class} } ) {
466
            if ( $field_mappings->{$class}->{$field}->{'enabled'} ) {
467
                while ( ( $server, $bib1_mapping ) =
468
                    each
469
                    %{ $field_mappings->{$class}->{$field}->{'bib1_mapping'} } )
470
                {
471
                    $self->add_bib1_field_map(
472
                        $class => $field => $server => $bib1_mapping );
473
                }
474
                $self->add_search_field_alias( $class => $field =>
475
                      $field_mappings->{$class}->{$field}->{'index'} );
476
                foreach my $alias (
477
                    @{ $field_mappings->{$class}->{$field}->{'aliases'} } )
478
                {
479
                    next
480
                      if ( $alias eq
481
                        $field_mappings->{$class}->{$field}->{'index'} );
482
                    $self->add_search_field_alias( $class => $field => $alias );
483
                }
484
            }
485
        }
486
    }
487
    foreach my $modifier ( keys %$modifier_mappings ) {
488
        if ( $modifier_mappings->{$modifier}->{'enabled'} ) {
489
            while ( ( $server, $bib1_mapping ) =
490
                each %{ $modifier_mappings->{$modifier}->{'bib1_mapping'} } )
491
            {
492
                $self->add_bib1_modifier_map(
493
                    $modifier => $server => $bib1_mapping );
494
            }
495
        }
496
    }
497
    foreach my $filter ( keys %$filter_mappings ) {
498
        if ( $filter_mappings->{$filter}->{'enabled'} ) {
499
            while ( ( $server, $bib1_mapping ) =
500
                each %{ $filter_mappings->{$filter}->{'bib1_mapping'} } )
501
            {
502
                if ( $filter_mappings->{$filter}->{'target_syntax_callback'} eq
503
                    'date_filter_target_callback' )
504
                {
505
                    $bib1_mapping->{'target_syntax_callback'} =
506
                      \&Koha::QueryParser::Driver::PQF::date_filter_target_callback;
507
                }
508
                $self->add_bib1_filter_map(
509
                    $filter => $server => $bib1_mapping );
510
            }
511
        }
512
    }
513
    foreach my $class ( keys %$relbumps ) {
514
        foreach my $field ( keys %{ $relbumps->{$class} } ) {
515
            if ( $relbumps->{$class}->{$field}->{'enabled'} ) {
516
                while ( ( $server, $bib1_mapping ) =
517
                    each %{ $relbumps->{$class}->{$field}->{'bib1_mapping'} } )
518
                {
519
                    $self->add_relevance_bump(
520
                        $class => $field => $server => $bib1_mapping,
521
                        1
522
                    );
523
                }
524
            }
525
        }
526
    }
527
    return $self;
528
}
529
530
=head2 load_config
531
532
  $QParser->load_config($file_name);
533
534
Load a YAML file with a parser configuration. The YAML file should match the following format:
535
536
    ---
537
    field_mappings:
538
      author:
539
        "":
540
          aliases:
541
            - au
542
          bib1_mapping:
543
            biblioserver:
544
              1: 1003
545
          enabled: 1
546
          index: ''
547
          label: ''
548
        conference:
549
          aliases:
550
            - conference
551
            - cfn
552
          bib1_mapping:
553
            biblioserver:
554
              1: 1006
555
          enabled: 1
556
          index: conference
557
          label: Conference
558
    filter_mappings:
559
      acqdate:
560
        bib1_mapping:
561
          biblioserver:
562
            1: Date-of-acquisition
563
            4: 4
564
            target_syntax_callback: date_filter_target_callback
565
        enabled: 1
566
        label: Acqdate
567
    modifier_mappings:
568
      AuthidAsc:
569
        bib1_mapping:
570
          authorityserver:
571
            "": 0
572
            1: Local-Number
573
            7: 1
574
            op: "@or"
575
        enabled: 1
576
        label: AuthidAsc
577
    ...
578
579
=cut
580
581
sub load_config {
582
    my ($self, $file) = @_;
583
    require YAML::Any;
584
    return unless ($file && -f $file);
585
    my $config = YAML::Any::LoadFile($file);
586
    return unless ($config);
587
    $self->initialize($config);
588
    return 1;
589
}
590
591
sub TEST_SETUP {
592
    my ($self) = @_;
593
594
    return $self;
595
    $self->default_search_class( 'keyword' );
596
597
    $self->add_bib1_field_map('keyword' => 'abstract' => 'biblioserver' => { '1' => '62' } );
598
    $self->add_search_field_alias( 'keyword' => 'abstract' => 'ab' );
599
    $self->add_bib1_field_map('keyword' => '' => 'biblioserver' => { '1' => '1016' } );
600
    $self->add_search_field_alias( 'keyword' => '' => 'kw' );
601
    $self->add_bib1_field_map('author' => '' => 'biblioserver' => { '1' => '1003' } );
602
    $self->add_search_field_alias( 'author' => '' => 'au' );
603
    $self->add_bib1_field_map('author' => 'personal' => 'biblioserver' => { '1' => '1004' } );
604
    $self->add_bib1_field_map('author' => 'corporate' => 'biblioserver' => { '1' => '1005' } );
605
    $self->add_search_field_alias( 'author' => 'corporate' => 'cpn' );
606
    $self->add_bib1_field_map('author' => 'conference' => 'biblioserver' => { '1' => '1006' } );
607
    $self->add_search_field_alias( 'author' => 'conference' => 'cfn' );
608
    $self->add_bib1_field_map('keyword' => 'local-classification' => 'biblioserver' => { '1' => '20' } );
609
    $self->add_search_field_alias( 'keyword' => 'local-classification' => 'lcn' );
610
    $self->add_search_field_alias( 'keyword' => 'local-classification' => 'callnum' );
611
    $self->add_bib1_field_map('keyword' => 'bib-level' => 'biblioserver' => { '1' => '1021' } );
612
    $self->add_bib1_field_map('keyword' => 'code-institution' => 'biblioserver' => { '1' => '56' } );
613
    $self->add_bib1_field_map('keyword' => 'language' => 'biblioserver' => { '1' => '54' } );
614
    $self->add_search_field_alias( 'keyword' => 'language' => 'ln' );
615
    $self->add_bib1_field_map('keyword' => 'record-type' => 'biblioserver' => { '1' => '1001' } );
616
    $self->add_search_field_alias( 'keyword' => 'record-type' => 'rtype' );
617
    $self->add_search_field_alias( 'keyword' => 'record-type' => 'mc-rtype' );
618
    $self->add_search_field_alias( 'keyword' => 'record-type' => 'mus' );
619
    $self->add_bib1_field_map('keyword' => 'content-type' => 'biblioserver' => { '1' => '1034' } );
620
    $self->add_search_field_alias( 'keyword' => 'content-type' => 'ctype' );
621
    $self->add_bib1_field_map('keyword' => 'lc-card-number' => 'biblioserver' => { '1' => '9' } );
622
    $self->add_search_field_alias( 'keyword' => 'lc-card-number' => 'lc-card' );
623
    $self->add_bib1_field_map('keyword' => 'local-number' => 'biblioserver' => { '1' => '12' } );
624
    $self->add_search_field_alias( 'keyword' => 'local-number' => 'sn' );
625
    $self->add_bib1_filter_map( 'biblioserver', 'copydate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => '30', '4' => '4' });
626
    $self->add_bib1_filter_map( 'biblioserver', 'pubdate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => 'pubdate', '4' => '4' });
627
    $self->add_bib1_filter_map( 'biblioserver', 'acqdate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => 'Date-of-acquisition', '4' => '4' });
628
    $self->add_bib1_field_map('keyword' => 'isbn' => 'biblioserver' => { '1' => '7' } );
629
    $self->add_search_field_alias( 'keyword' => 'isbn' => 'nb' );
630
    $self->add_bib1_field_map('keyword' => 'issn' => 'biblioserver' => { '1' => '8' } );
631
    $self->add_search_field_alias( 'keyword' => 'issn' => 'ns' );
632
    $self->add_bib1_field_map('keyword' => 'identifier-standard' => 'biblioserver' => { '1' => '1007' } );
633
    $self->add_search_field_alias( 'keyword' => 'identifier-standard' => 'ident' );
634
    $self->add_bib1_field_map('keyword' => 'upc' => 'biblioserver' => { '1' => 'UPC' } );
635
    $self->add_search_field_alias( 'keyword' => 'upc' => 'upc' );
636
    $self->add_bib1_field_map('keyword' => 'ean' => 'biblioserver' => { '1' => 'EAN' } );
637
    $self->add_search_field_alias( 'keyword' => 'ean' => 'ean' );
638
    $self->add_bib1_field_map('keyword' => 'music' => 'biblioserver' => { '1' => 'Music-number' } );
639
    $self->add_search_field_alias( 'keyword' => 'music' => 'music' );
640
    $self->add_bib1_field_map('keyword' => 'stock-number' => 'biblioserver' => { '1' => '1028' } );
641
    $self->add_search_field_alias( 'keyword' => 'stock-number' => 'stock-number' );
642
    $self->add_bib1_field_map('keyword' => 'material-type' => 'biblioserver' => { '1' => '1031' } );
643
    $self->add_search_field_alias( 'keyword' => 'material-type' => 'material-type' );
644
    $self->add_bib1_field_map('keyword' => 'place-publication' => 'biblioserver' => { '1' => '59' } );
645
    $self->add_search_field_alias( 'keyword' => 'place-publication' => 'pl' );
646
    $self->add_bib1_field_map('keyword' => 'personal-name' => 'biblioserver' => { '1' => 'Personal-name' } );
647
    $self->add_search_field_alias( 'keyword' => 'personal-name' => 'pn' );
648
    $self->add_bib1_field_map('keyword' => 'publisher' => 'biblioserver' => { '1' => '1018' } );
649
    $self->add_search_field_alias( 'keyword' => 'publisher' => 'pb' );
650
    $self->add_bib1_field_map('keyword' => 'note' => 'biblioserver' => { '1' => '63' } );
651
    $self->add_search_field_alias( 'keyword' => 'note' => 'nt' );
652
    $self->add_bib1_field_map('keyword' => 'record-control-number' => 'biblioserver' => { '1' => '1045' } );
653
    $self->add_search_field_alias( 'keyword' => 'record-control-number' => 'rcn' );
654
    $self->add_bib1_field_map('subject' => '' => 'biblioserver' => { '1' => '21' } );
655
    $self->add_search_field_alias( 'subject' => '' => 'su' );
656
    $self->add_search_field_alias( 'subject' => '' => 'su-to' );
657
    $self->add_search_field_alias( 'subject' => '' => 'su-geo' );
658
    $self->add_search_field_alias( 'subject' => '' => 'su-ut' );
659
    $self->add_bib1_field_map('subject' => 'name-personal' => 'biblioserver' => { '1' => '1009' } );
660
    $self->add_search_field_alias( 'subject' => 'name-personal' => 'su-na' );
661
    $self->add_bib1_field_map('title' => '' => 'biblioserver' => { '1' => '4' } );
662
    $self->add_search_field_alias( 'title' => '' => 'ti' );
663
    $self->add_bib1_field_map('title' => 'cover' => 'biblioserver' => { '1' => '36' } );
664
    $self->add_search_field_alias( 'title' => 'cover' => 'title-cover' );
665
    $self->add_bib1_field_map('keyword' => 'host-item' => 'biblioserver' => { '1' => '1033' } );
666
    $self->add_bib1_field_map('keyword' => 'video-mt' => 'biblioserver' => { '1' => 'Video-mt' } );
667
    $self->add_bib1_field_map('keyword' => 'graphics-type' => 'biblioserver' => { '1' => 'Graphic-type' } );
668
    $self->add_bib1_field_map('keyword' => 'graphics-support' => 'biblioserver' => { '1' => 'Graphic-support' } );
669
    $self->add_bib1_field_map('keyword' => 'type-of-serial' => 'biblioserver' => { '1' => 'Type-Of-Serial' } );
670
    $self->add_bib1_field_map('keyword' => 'regularity-code' => 'biblioserver' => { '1' => 'Regularity-code' } );
671
    $self->add_bib1_field_map('keyword' => 'material-type' => 'biblioserver' => { '1' => 'Material-type' } );
672
    $self->add_bib1_field_map('keyword' => 'literature-code' => 'biblioserver' => { '1' => 'Literature-Code' } );
673
    $self->add_bib1_field_map('keyword' => 'biography-code' => 'biblioserver' => { '1' => 'Biography-code' } );
674
    $self->add_bib1_field_map('keyword' => 'illustration-code' => 'biblioserver' => { '1' => 'Illustration-code' } );
675
    $self->add_bib1_field_map('title' => 'series' => 'biblioserver' => { '1' => '5' } );
676
    $self->add_search_field_alias( 'title' => 'series' => 'title-series' );
677
    $self->add_search_field_alias( 'title' => 'series' => 'se' );
678
    $self->add_bib1_field_map('title' => 'uniform' => 'biblioserver' => { '1' => 'Title-uniform' } );
679
    $self->add_search_field_alias( 'title' => 'uniform' => 'title-uniform' );
680
    $self->add_bib1_field_map('subject' => 'authority-number' => 'biblioserver' => { '1' => 'Koha-Auth-Number' } );
681
    $self->add_search_field_alias( 'subject' => 'authority-number' => 'an' );
682
    $self->add_bib1_field_map('keyword' => 'control-number' => 'biblioserver' => { '1' => '9001' } );
683
    $self->add_bib1_field_map('keyword' => 'biblionumber' => 'biblioserver' => { '1' => '9002', '5' => '100' } );
684
    $self->add_bib1_field_map('keyword' => 'totalissues' => 'biblioserver' => { '1' => '9003' } );
685
    $self->add_bib1_field_map('keyword' => 'cn-bib-source' => 'biblioserver' => { '1' => '9004' } );
686
    $self->add_bib1_field_map('keyword' => 'cn-bib-sort' => 'biblioserver' => { '1' => '9005' } );
687
    $self->add_bib1_field_map('keyword' => 'itemtype' => 'biblioserver' => { '1' => '9006' } );
688
    $self->add_search_field_alias( 'keyword' => 'itemtype' => 'mc-itemtype' );
689
    $self->add_bib1_field_map('keyword' => 'cn-class' => 'biblioserver' => { '1' => '9007' } );
690
    $self->add_bib1_field_map('keyword' => 'cn-item' => 'biblioserver' => { '1' => '9008' } );
691
    $self->add_bib1_field_map('keyword' => 'cn-prefix' => 'biblioserver' => { '1' => '9009' } );
692
    $self->add_bib1_field_map('keyword' => 'cn-suffix' => 'biblioserver' => { '1' => '9010' } );
693
    $self->add_bib1_field_map('keyword' => 'suppress' => 'biblioserver' => { '1' => '9011' } );
694
    $self->add_bib1_field_map('keyword' => 'id-other' => 'biblioserver' => { '1' => '9012' } );
695
    $self->add_bib1_field_map('keyword' => 'date-entered-on-file' => 'biblioserver' => { '1' => 'date-entered-on-file' } );
696
    $self->add_bib1_field_map('keyword' => 'extent' => 'biblioserver' => { '1' => 'Extent' } );
697
    $self->add_bib1_field_map('keyword' => 'llength' => 'biblioserver' => { '1' => 'llength' } );
698
    $self->add_bib1_field_map('keyword' => 'summary' => 'biblioserver' => { '1' => 'Summary' } );
699
    $self->add_bib1_field_map('keyword' => 'withdrawn' => 'biblioserver' => { '1' => '8001' } );
700
    $self->add_bib1_field_map('keyword' => 'lost' => 'biblioserver' => { '1' => '8002' } );
701
    $self->add_bib1_field_map('keyword' => 'classification-source' => 'biblioserver' => { '1' => '8003' } );
702
    $self->add_bib1_field_map('keyword' => 'materials-specified' => 'biblioserver' => { '1' => '8004' } );
703
    $self->add_bib1_field_map('keyword' => 'damaged' => 'biblioserver' => { '1' => '8005' } );
704
    $self->add_bib1_field_map('keyword' => 'restricted' => 'biblioserver' => { '1' => '8006' } );
705
    $self->add_bib1_field_map('keyword' => 'cn-sort' => 'biblioserver' => { '1' => '8007' } );
706
    $self->add_bib1_field_map('keyword' => 'notforloan' => 'biblioserver' => { '1' => '8008', '4' => '109' } );
707
    $self->add_bib1_field_map('keyword' => 'ccode' => 'biblioserver' => { '1' => '8009' } );
708
    $self->add_search_field_alias( 'keyword' => 'ccode' => 'mc-ccode' );
709
    $self->add_bib1_field_map('keyword' => 'itemnumber' => 'biblioserver' => { '1' => '8010' } );
710
    $self->add_bib1_field_map('keyword' => 'homebranch' => 'biblioserver' => { '1' => 'homebranch' } );
711
    $self->add_search_field_alias( 'keyword' => 'homebranch' => 'branch' );
712
    $self->add_bib1_field_map('keyword' => 'holdingbranch' => 'biblioserver' => { '1' => '8012' } );
713
    $self->add_bib1_field_map('keyword' => 'location' => 'biblioserver' => { '1' => '8013' } );
714
    $self->add_search_field_alias( 'keyword' => 'location' => 'mc-loc' );
715
    $self->add_bib1_field_map('keyword' => 'acqsource' => 'biblioserver' => { '1' => '8015' } );
716
    $self->add_bib1_field_map('keyword' => 'coded-location-qualifier' => 'biblioserver' => { '1' => '8016' } );
717
    $self->add_bib1_field_map('keyword' => 'price' => 'biblioserver' => { '1' => '8017' } );
718
    $self->add_bib1_field_map('keyword' => 'stocknumber' => 'biblioserver' => { '1' => '1062' } );
719
    $self->add_search_field_alias( 'keyword' => 'stocknumber' => 'inv' );
720
    $self->add_bib1_field_map('keyword' => 'stack' => 'biblioserver' => { '1' => '8018' } );
721
    $self->add_bib1_field_map('keyword' => 'issues' => 'biblioserver' => { '1' => '8019' } );
722
    $self->add_bib1_field_map('keyword' => 'renewals' => 'biblioserver' => { '1' => '8020' } );
723
    $self->add_bib1_field_map('keyword' => 'reserves' => 'biblioserver' => { '1' => '8021' } );
724
    $self->add_bib1_field_map('keyword' => 'local-classification' => 'biblioserver' => { '1' => '8022' } );
725
    $self->add_bib1_field_map('keyword' => 'barcode' => 'biblioserver' => { '1' => '8023' } );
726
    $self->add_search_field_alias( 'keyword' => 'barcode' => 'bc' );
727
    $self->add_bib1_field_map('keyword' => 'onloan' => 'biblioserver' => { '1' => '8024' } );
728
    $self->add_bib1_field_map('keyword' => 'datelastseen' => 'biblioserver' => { '1' => '8025' } );
729
    $self->add_bib1_field_map('keyword' => 'datelastborrowed' => 'biblioserver' => { '1' => '8026' } );
730
    $self->add_bib1_field_map('keyword' => 'copynumber' => 'biblioserver' => { '1' => '8027' } );
731
    $self->add_bib1_field_map('keyword' => 'uri' => 'biblioserver' => { '1' => '8028' } );
732
    $self->add_bib1_field_map('keyword' => 'replacementprice' => 'biblioserver' => { '1' => '8029' } );
733
    $self->add_bib1_field_map('keyword' => 'replacementpricedate' => 'biblioserver' => { '1' => '8030' } );
734
    $self->add_bib1_field_map('keyword' => 'itype' => 'biblioserver' => { '1' => '8031' } );
735
    $self->add_search_field_alias( 'keyword' => 'itype' => 'mc-itype' );
736
    $self->add_bib1_field_map('keyword' => 'ff8-22' => 'biblioserver' => { '1' => '8822' } );
737
    $self->add_bib1_field_map('keyword' => 'ff8-23' => 'biblioserver' => { '1' => '8823' } );
738
    $self->add_bib1_field_map('keyword' => 'ff8-34' => 'biblioserver' => { '1' => '8834' } );
739
# Audience
740
    $self->add_bib1_field_map('keyword' => 'audience' => 'biblioserver' => { '1' => '8822' } );
741
    $self->add_search_field_alias( 'keyword' => 'audience' => 'aud' );
742
743
# Content and Literary form
744
    $self->add_bib1_field_map('keyword' => 'fiction' => 'biblioserver' => { '1' => '8833' } );
745
    $self->add_search_field_alias( 'keyword' => 'fiction' => 'fic' );
746
    $self->add_bib1_field_map('keyword' => 'biography' => 'biblioserver' => { '1' => '8834' } );
747
    $self->add_search_field_alias( 'keyword' => 'biography' => 'bio' );
748
749
# Format
750
    $self->add_bib1_field_map('keyword' => 'format' => 'biblioserver' => { '1' => '8823' } );
751
# format used as a limit FIXME: needed?
752
    $self->add_bib1_field_map('keyword' => 'l-format' => 'biblioserver' => { '1' => '8703' } );
753
754
    $self->add_bib1_field_map('keyword' => 'illustration-code' => 'biblioserver' => { '1' => 'Illustration-code ' } );
755
756
# Lexile Number
757
    $self->add_bib1_field_map('keyword' => 'lex' => 'biblioserver' => { '1' => '9903 r=r' } );
758
759
#Accelerated Reader Level
760
    $self->add_bib1_field_map('keyword' => 'arl' => 'biblioserver' => { '1' => '9904 r=r' } );
761
762
#Accelerated Reader Point
763
    $self->add_bib1_field_map('keyword' => 'arp' => 'biblioserver' => { '1' => '9013 r=r' } );
764
765
# Curriculum
766
    $self->add_bib1_field_map('keyword' => 'curriculum' => 'biblioserver' => { '1' => '9658' } );
767
768
## Statuses
769
    $self->add_bib1_field_map('keyword' => 'popularity' => 'biblioserver' => { '1' => 'issues' } );
770
771
## Type Limits
772
    $self->add_bib1_field_map('keyword' => 'dt-bks' => 'biblioserver' => { '1' => '8700' } );
773
    $self->add_bib1_field_map('keyword' => 'dt-vis' => 'biblioserver' => { '1' => '8700' } );
774
    $self->add_bib1_field_map('keyword' => 'dt-sr' => 'biblioserver' => { '1' => '8700' } );
775
    $self->add_bib1_field_map('keyword' => 'dt-cf' => 'biblioserver' => { '1' => '8700' } );
776
    $self->add_bib1_field_map('keyword' => 'dt-map' => 'biblioserver' => { '1' => '8700' } );
777
778
    $self->add_bib1_field_map('keyword' => 'name' => 'biblioserver' => { '1' => '1002' } );
779
    $self->add_bib1_field_map('keyword' => 'item' => 'biblioserver' => { '1' => '9520' } );
780
    $self->add_bib1_field_map('keyword' => 'host-item-number' => 'biblioserver' => { '1' => '8911' } );
781
    $self->add_search_field_alias( 'keyword' => 'host-item-number' => 'hi' );
782
783
    $self->add_bib1_field_map('keyword' => 'alwaysmatch' => 'biblioserver' => { '1' => '_ALLRECORDS', '2' => '103' } );
784
    $self->add_bib1_field_map('subject' => 'complete' => 'biblioserver' => { '1' => '21', '3' => '1', '4' => '1', '5' => '100', '6' => '3' } );
785
786
    $self->add_bib1_modifier_map('relevance' => 'biblioserver' => { '2' => '102' } );
787
    $self->add_bib1_modifier_map('title-sort-za' => 'biblioserver' => { '7' => '2', '1' => '36', '' => '0', 'op' => '@or' } );
788
    $self->add_bib1_modifier_map('title-sort-az' => 'biblioserver' => { '7' => '1', '1' => '36', '' => '0', 'op' => '@or' } );
789
    $self->add_bib1_modifier_map('relevance_dsc' => 'biblioserver' => { '2' => '102' } );
790
    $self->add_bib1_modifier_map('title_dsc' => 'biblioserver' => { '7' => '2', '1' => '4', '' => '0', 'op' => '@or' } );
791
    $self->add_bib1_modifier_map('title_asc' => 'biblioserver' => { '7' => '1', '1' => '4', '' => '0', 'op' => '@or' } );
792
    $self->add_bib1_modifier_map('author_asc' => 'biblioserver' => { '7' => '2', '1' => '1003', '' => '0', 'op' => '@or' } );
793
    $self->add_bib1_modifier_map('author_dsc' => 'biblioserver' => { '7' => '1', '1' => '1003', '' => '0', 'op' => '@or' } );
794
    $self->add_bib1_modifier_map('popularity_asc' => 'biblioserver' => { '7' => '2', '1' => '9003', '' => '0', 'op' => '@or' } );
795
    $self->add_bib1_modifier_map('popularity_dsc' => 'biblioserver' => { '7' => '1', '1' => '9003', '' => '0', 'op' => '@or' } );
796
    $self->add_bib1_modifier_map('call_number_asc' => 'biblioserver' => { '7' => '2', '1' => '8007', '' => '0', 'op' => '@or' } );
797
    $self->add_bib1_modifier_map('call_number_dsc' => 'biblioserver' => { '7' => '1', '1' => '8007', '' => '0', 'op' => '@or' } );
798
    $self->add_bib1_modifier_map('pubdate_asc' => 'biblioserver' => { '7' => '2', '1' => '31', '' => '0', 'op' => '@or' } );
799
    $self->add_bib1_modifier_map('pubdate_dsc' => 'biblioserver' => { '7' => '1', '1' => '31', '' => '0', 'op' => '@or' } );
800
    $self->add_bib1_modifier_map('acqdate_asc' => 'biblioserver' => { '7' => '2', '1' => '32', '' => '0', 'op' => '@or' } );
801
    $self->add_bib1_modifier_map('acqdate_dsc' => 'biblioserver' => { '7' => '1', '1' => '32', '' => '0', 'op' => '@or' } );
802
803
    $self->add_bib1_modifier_map('title_za' => 'biblioserver' => { '7' => '2', '1' => '4', '' => '0', 'op' => '@or' } );
804
    $self->add_bib1_modifier_map('title_az' => 'biblioserver' => { '7' => '1', '1' => '4', '' => '0', 'op' => '@or' } );
805
    $self->add_bib1_modifier_map('author_za' => 'biblioserver' => { '7' => '2', '1' => '1003', '' => '0', 'op' => '@or' } );
806
    $self->add_bib1_modifier_map('author_az' => 'biblioserver' => { '7' => '1', '1' => '1003', '' => '0', 'op' => '@or' } );
807
    $self->add_bib1_modifier_map('ascending' => 'biblioserver' => { '7' => '1' } );
808
    $self->add_bib1_modifier_map('descending' => 'biblioserver' => { '7' => '2' } );
809
810
    $self->add_bib1_field_map('title' => 'exacttitle' => 'biblioserver' => { '1' => '4', '4' => '1', '6' => '3' } );
811
    $self->add_search_field_alias( 'title' => 'exacttitle' => 'ti,ext' );
812
    $self->add_bib1_field_map('author' => 'exactauthor' => 'biblioserver' => { '1' => '1003', '4' => '1', '6' => '3' } );
813
    $self->add_search_field_alias( 'author' => 'exactauthor' => 'au,ext' );
814
815
    $self->add_bib1_field_map('subject' => 'headingmain' => 'authorityserver' => { '1' => 'Heading-Main' } );
816
    $self->add_bib1_field_map('subject' => 'heading' => 'authorityserver' => { '1' => 'Heading' } );
817
    $self->add_bib1_field_map('subject' => 'matchheading' => 'authorityserver' => { '1' => 'Match-heading' } );
818
    $self->add_bib1_field_map('subject' => 'seefrom' => 'authorityserver' => { '1' => 'Match-heading-see-from' } );
819
    $self->add_bib1_field_map('subject' => '' => 'authorityserver' => { '1' => 'Match-heading' } );
820
    $self->add_bib1_field_map('keyword' => 'alwaysmatch' => 'authorityserver' => { '1' => '_ALLRECORDS', '2' => '103' } );
821
    $self->add_bib1_field_map('keyword' => 'match' => 'authorityserver' => { '1' => 'Match' } );
822
    $self->add_bib1_field_map('keyword' => 'thesaurus' => 'authorityserver' => { '1' => 'Subject-heading-thesaurus' } );
823
    $self->add_bib1_field_map('keyword' => 'authtype' => 'authorityserver' => { '1' => 'authtype', '5' => '100' } );
824
    $self->add_bib1_field_map('keyword' => '' => 'authorityserver' => { '1' => 'Any' } );
825
    $self->add_search_field_alias( 'subject' => 'headingmain' => 'mainmainentry' );
826
    $self->add_search_field_alias( 'subject' => 'heading' => 'mainentry' );
827
    $self->add_search_field_alias( 'subject' => 'heading' => 'he' );
828
    $self->add_search_field_alias( 'subject' => 'matchheading' => 'match-heading' );
829
    $self->add_search_field_alias( 'keyword' => '' => 'any' );
830
    $self->add_search_field_alias( 'keyword' => 'match' => 'match' );
831
    $self->add_search_field_alias( 'subject' => 'seefrom' => 'see-from' );
832
    $self->add_search_field_alias( 'keyword' => 'thesaurus' => 'thesaurus' );
833
    $self->add_search_field_alias( 'keyword' => 'alwaysmatch' => 'all' );
834
    $self->add_search_field_alias( 'keyword' => 'authtype' => 'authtype' );
835
    $self->add_search_field_alias( 'keyword' => 'authtype' => 'at' );
836
837
    $self->add_bib1_field_map('subject' => 'start' => 'authorityserver' => { '3' => '2', '4' => '1', '5' => '1' } );
838
    $self->add_bib1_field_map('subject' => 'exact' => 'authorityserver' => { '4' => '1', '5' => '100', '6' => '3' } );
839
840
    $self->add_bib1_modifier_map('HeadingAsc' => 'authorityserver' => { '7' => '1', '1' => 'Heading', '' => '0', 'op' => '@or' } );
841
    $self->add_bib1_modifier_map('HeadingDsc' => 'authorityserver' => { '7' => '2', '1' => 'Heading', '' => '0', 'op' => '@or' } );
842
    $self->add_bib1_modifier_map('AuthidAsc' => 'authorityserver' => { '7' => '1', '1' => 'Local-Number', '' => '0', 'op' => '@or' } );
843
    $self->add_bib1_modifier_map('AuthidDsc' => 'authorityserver' => { '7' => '2', '1' => 'Local-Number', '' => '0', 'op' => '@or' } );
844
    $self->add_bib1_modifier_map('Relevance' => 'authorityserver' => { '2' => '102' } );
845
846
    return $self;
847
}
848
849
1;
(-)a/Koha/QueryParser/Driver/PQF/Util.pm (+22 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::Util;
2
use Scalar::Util qw(looks_like_number);
3
4
use strict;
5
use warnings;
6
7
sub attributes_to_attr_string {
8
    my ($attributes) = @_;
9
    my $attr_string = '';
10
    my $key;
11
    my $value;
12
    while (($key, $value) = each(%$attributes)) {
13
        next unless looks_like_number($key);
14
        $attr_string .= ' @attr ' . $key . '=' . $value . ' ';
15
    }
16
    $attr_string =~ s/^\s*//;
17
    $attr_string =~ s/\s*$//;
18
    $attr_string .= ' ' . $attributes->{''} if defined $attributes->{''};
19
    return $attr_string;
20
}
21
22
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan.pm (+46 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan;
2
use base 'OpenILS::QueryParser::query_plan';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::target_syntax
8
9
    my $pqf = $query_plan->target_syntax($server);
10
11
Transforms an OpenILS::QueryParser::query_plan object into PQF. Do not use directly.
12
13
=cut
14
15
sub target_syntax {
16
    my ($self, $server) = @_;
17
    my $pqf = '';
18
    my $node_pqf;
19
    my $node_count = 0;
20
21
    for my $node ( @{$self->query_nodes} ) {
22
23
        if (ref($node)) {
24
            $node_pqf = $node->target_syntax($server);
25
            $node_count++ if $node_pqf;
26
            $pqf .= $node_pqf;
27
        }
28
    }
29
    $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf;
30
    $node_count = ($node_count ? '1' : '0');
31
    for my $node ( @{$self->filters} ) {
32
        if (ref($node)) {
33
            $node_pqf = $node->target_syntax($server);
34
            $node_count++ if $node_pqf;
35
            $pqf .= $node_pqf;
36
        }
37
    }
38
    $pqf = ($self->joiner eq '|' ? ' @or ' : ' @and ') x ($node_count - 1) . $pqf;
39
    foreach my $modifier ( @{$self->modifiers} ) {
40
        my $modifierpqf = $modifier->target_syntax($server, $self);
41
        $pqf = $modifierpqf . ' ' . $pqf if $modifierpqf;
42
    }
43
    return ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $pqf;
44
}
45
46
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan/facet.pm (+22 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan::facet;
2
use base 'OpenILS::QueryParser::query_plan::facet';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::facet::target_syntax
8
9
    my $pqf = $facet->target_syntax($server);
10
11
Transforms an OpenILS::QueryParser::query_plan::facet object into PQF. Do not use
12
directly.
13
14
=cut
15
16
sub target_syntax {
17
    my ($self, $server) = @_;
18
19
    return '';
20
}
21
22
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan/filter.pm (+27 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan::filter;
2
use base 'OpenILS::QueryParser::query_plan::filter';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::filter::target_syntax
8
9
    my $pqf = $filter->target_syntax($server);
10
11
Transforms an OpenILS::QueryParser::query_plan::filter object into PQF. Do not use
12
directly.
13
14
=cut
15
16
sub target_syntax {
17
    my ($self, $server) = @_;
18
    my $attributes = $self->plan->QueryParser->bib1_mapping_by_name( 'filter', $self->name, $server );
19
20
    if ($attributes->{'target_syntax_callback'}) {
21
        return $attributes->{'target_syntax_callback'}->($self->plan->QueryParser, $self->name, $self->args, $self->negate, $server);
22
    } else {
23
        return '';
24
    }
25
}
26
27
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan/modifier.pm (+27 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan::modifier;
2
use base 'OpenILS::QueryParser::query_plan::modifier';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::modifier::target_syntax
8
9
    my $pqf = $modifier->target_syntax($server, $query_plan);
10
11
Transforms an OpenILS::QueryParser::query_plan::modifier object into PQF. Do not use
12
directly. The second argument points ot the query_plan, since modifiers do
13
not have a reference to their parent query_plan.
14
15
=cut
16
17
sub target_syntax {
18
    my ($self, $server, $query_plan) = @_;
19
    my $pqf = '';
20
    my @fields;
21
22
    my $attributes = $query_plan->QueryParser->bib1_mapping_by_name('modifier', $self->name, $server);
23
    $pqf = ($attributes->{'op'} ? $attributes->{'op'} . ' ' : '') . ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $attributes->{'attr_string'};
24
    return $pqf;
25
}
26
27
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan/node.pm (+75 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan::node;
2
use base 'OpenILS::QueryParser::query_plan::node';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::node::target_syntax
8
9
    my $pqf = $node->target_syntax($server);
10
11
Transforms an OpenILS::QueryParser::query_plan::node object into PQF. Do not use directly.
12
13
=cut
14
15
sub target_syntax {
16
    my ($self, $server) = @_;
17
    my $pqf = '';
18
    my $atom_content;
19
    my $atom_count = 0;
20
    my @fields;
21
    my $fieldobj;
22
    my $relbump;
23
24
    if (scalar(@{$self->fields})) {
25
        foreach my $field (@{$self->fields}) {
26
            $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $self->classname, $field, $server);
27
            $relbump = $self->plan->QueryParser->bib1_mapping_by_name('relevance_bump', $self->classname, $field, $server);
28
            if ($relbump) {
29
                $fieldobj->{'attr_string'} .= ' ' . $relbump->{'attr_string'};
30
            }
31
            push @fields, $fieldobj;
32
        }
33
    } else {
34
        $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $self->classname, '', $server);
35
        my $relbumps = $self->plan->QueryParser->bib1_mapping_by_name('relevance_bump', $self->classname, '', $server);
36
        push @fields, $fieldobj;
37
        if ($relbumps) {
38
            foreach my $field (keys %$relbumps) {
39
                $relbump = $relbumps->{$field};
40
                $fieldobj = $self->plan->QueryParser->bib1_mapping_by_name('field', $relbump->{'classname'}, $relbump->{'field'}, $server);
41
                $fieldobj->{'attr_string'} .= ' ' . $relbump->{'attr_string'};
42
                push @fields, $fieldobj;
43
            }
44
        }
45
    }
46
47
    if (@{$self->phrases}) {
48
        foreach my $phrase (@{$self->phrases}) {
49
            if ($phrase) {
50
                $pqf .= ' @or ' x (scalar(@fields) - 1);
51
                foreach my $attributes (@fields) {
52
                    $pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=1') . ' "' . $phrase . '" ';
53
                }
54
                $atom_count++;
55
            }
56
        }
57
    } else {
58
        foreach my $atom (@{$self->query_atoms}) {
59
            if (ref($atom)) {
60
                $atom_content = $atom->target_syntax($server);
61
                if ($atom_content) {
62
                    $pqf .= ' @or ' x (scalar(@fields) - 1);
63
                    foreach my $attributes (@fields) {
64
                        $pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=6 ') . $atom_content . ' ';
65
                    }
66
                    $atom_count++;
67
                }
68
            }
69
        }
70
    }
71
    $pqf = (OpenILS::QueryParser::_util::default_joiner eq '|' ? ' @or ' : ' @and ') x ($atom_count - 1) . $pqf;
72
    return ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $pqf;
73
}
74
75
1;
(-)a/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm (+22 lines)
Line 0 Link Here
1
package Koha::QueryParser::Driver::PQF::query_plan::node::atom;
2
use base 'OpenILS::QueryParser::query_plan::node::atom';
3
4
use strict;
5
use warnings;
6
7
=head2 Koha::QueryParser::Driver::PQF::query_plan::node::atom::target_syntax
8
9
    my $pqf = $atom->target_syntax($server);
10
11
Transforms an OpenILS::QueryParser::query_plan::node::atom object into PQF. Do not use
12
directly.
13
14
=cut
15
16
sub target_syntax {
17
    my ($self, $server) = @_;
18
19
    return ' "' .  $self->content . '" ';
20
}
21
22
1;
(-)a/etc/searchengine/queryparser.yaml (-1 / +1442 lines)
Line 0 Link Here
0
- 
1
---
2
field_mappings:
3
  author:
4
    "":
5
      aliases:
6
        - au
7
      bib1_mapping:
8
        biblioserver:
9
          1: 1003
10
      enabled: 1
11
      index: ''
12
      label: ''
13
    conference:
14
      aliases:
15
        - conference
16
        - cfn
17
      bib1_mapping:
18
        biblioserver:
19
          1: 1006
20
      enabled: 1
21
      index: conference
22
      label: Conference
23
    corporate:
24
      aliases:
25
        - corporate
26
        - cpn
27
      bib1_mapping:
28
        biblioserver:
29
          1: 1005
30
      enabled: 1
31
      index: corporate
32
      label: Corporate
33
    exactauthor:
34
      aliases:
35
        - exactauthor
36
        - au,ext
37
      bib1_mapping:
38
        biblioserver:
39
          1: 1003
40
          4: 1
41
          6: 3
42
      enabled: 1
43
      index: exactauthor
44
      label: Exactauthor
45
    personal:
46
      aliases:
47
        - personal
48
      bib1_mapping:
49
        biblioserver:
50
          1: 1004
51
      enabled: 1
52
      index: personal
53
      label: Personal
54
  keyword:
55
    "":
56
      aliases:
57
        - any
58
        - kw
59
      bib1_mapping:
60
        authorityserver:
61
          1: Any
62
        biblioserver:
63
          1: 1016
64
      enabled: 1
65
      index: 'keyword'
66
      label: 'Keyword'
67
    abstract:
68
      aliases:
69
        - abstract
70
        - ab
71
      bib1_mapping:
72
        biblioserver:
73
          1: 62
74
      enabled: 1
75
      index: abstract
76
      label: Abstract
77
    acqsource:
78
      aliases:
79
        - acqsource
80
      bib1_mapping:
81
        biblioserver:
82
          1: 8015
83
      enabled: 1
84
      index: acqsource
85
      label: Acqsource
86
    alwaysmatch:
87
      aliases:
88
        - alwaysmatch
89
        - all
90
      bib1_mapping:
91
        authorityserver:
92
          1: _ALLRECORDS
93
          2: 103
94
        biblioserver:
95
          1: _ALLRECORDS
96
          2: 103
97
      enabled: 1
98
      index: alwaysmatch
99
      label: Alwaysmatch
100
    arl:
101
      aliases:
102
        - arl
103
      bib1_mapping:
104
        biblioserver:
105
          1: 9904 r=r
106
      enabled: 1
107
      index: arl
108
      label: Arl
109
    arp:
110
      aliases:
111
        - arp
112
      bib1_mapping:
113
        biblioserver:
114
          1: 9013 r=r
115
      enabled: 1
116
      index: arp
117
      label: Arp
118
    audience:
119
      aliases:
120
        - audience
121
        - aud
122
      bib1_mapping:
123
        biblioserver:
124
          1: 8822
125
      enabled: 1
126
      index: audience
127
      label: Audience
128
    authtype:
129
      aliases:
130
        - authtype
131
        - at
132
      bib1_mapping:
133
        authorityserver:
134
          1: authtype
135
          5: 100
136
      enabled: 1
137
      index: authtype
138
      label: Authtype
139
    barcode:
140
      aliases:
141
        - barcode
142
        - bc
143
      bib1_mapping:
144
        biblioserver:
145
          1: 8023
146
      enabled: 1
147
      index: barcode
148
      label: Barcode
149
    bib-level:
150
      bib1_mapping:
151
        biblioserver:
152
          1: 1021
153
      enabled: 1
154
      index: bib-level
155
      aliases:
156
        - bib-level
157
      label: Bib-level
158
    biblionumber:
159
      bib1_mapping:
160
        biblioserver:
161
          1: 9002
162
          5: 100
163
      enabled: 1
164
      index: biblionumber
165
      aliases:
166
        - biblionumber
167
      label: Biblionumber
168
    biography:
169
      bib1_mapping:
170
        biblioserver:
171
          1: 8834
172
      enabled: 1
173
      index: biography
174
      aliases:
175
        - biography
176
        - bio
177
      label: Biography
178
    biography-code:
179
      bib1_mapping:
180
        biblioserver:
181
          1: Biography-code
182
      enabled: 1
183
      index: biography-code
184
      aliases:
185
        - biography-code
186
      label: Biography-code
187
    ccode:
188
      bib1_mapping:
189
        biblioserver:
190
          1: 8009
191
      enabled: 1
192
      index: ccode
193
      aliases:
194
        - ccode
195
        - mc-ccode
196
      label: Ccode
197
    classification-source:
198
      bib1_mapping:
199
        biblioserver:
200
          1: 8003
201
      enabled: 1
202
      index: classification-source
203
      aliases:
204
        - classification-source
205
      label: Classification-source
206
    cn-bib-sort:
207
      bib1_mapping:
208
        biblioserver:
209
          1: 9005
210
      enabled: 1
211
      index: cn-bib-sort
212
      aliases:
213
        - cn-bib-sort
214
      label: Cn-bib-sort
215
    cn-bib-source:
216
      bib1_mapping:
217
        biblioserver:
218
          1: 9004
219
      enabled: 1
220
      index: cn-bib-source
221
      aliases:
222
        - cn-bib-source
223
      label: Cn-bib-source
224
    cn-class:
225
      bib1_mapping:
226
        biblioserver:
227
          1: 9007
228
      enabled: 1
229
      index: cn-class
230
      aliases:
231
        - cn-class
232
      label: Cn-class
233
    cn-item:
234
      bib1_mapping:
235
        biblioserver:
236
          1: 9008
237
      enabled: 1
238
      index: cn-item
239
      aliases:
240
        - cn-item
241
      label: Cn-item
242
    cn-prefix:
243
      bib1_mapping:
244
        biblioserver:
245
          1: 9009
246
      enabled: 1
247
      index: cn-prefix
248
      aliases:
249
        - cn-prefix
250
      label: Cn-prefix
251
    cn-sort:
252
      bib1_mapping:
253
        biblioserver:
254
          1: 8007
255
      enabled: 1
256
      index: cn-sort
257
      aliases:
258
        - cn-sort
259
      label: Cn-sort
260
    cn-suffix:
261
      bib1_mapping:
262
        biblioserver:
263
          1: 9010
264
      enabled: 1
265
      index: cn-suffix
266
      aliases:
267
        - cn-suffix
268
      label: Cn-suffix
269
    code-institution:
270
      bib1_mapping:
271
        biblioserver:
272
          1: 56
273
      enabled: 1
274
      index: code-institution
275
      aliases:
276
        - code-institution
277
      label: Code-institution
278
    coded-location-qualifier:
279
      bib1_mapping:
280
        biblioserver:
281
          1: 8016
282
      enabled: 1
283
      index: coded-location-qualifier
284
      aliases:
285
        - coded-location-qualifier
286
      label: Coded-location-qualifier
287
    content-type:
288
      bib1_mapping:
289
        biblioserver:
290
          1: 1034
291
      enabled: 1
292
      index: content-type
293
      aliases:
294
        - content-type
295
        - ctype
296
      label: Content-type
297
    control-number:
298
      bib1_mapping:
299
        biblioserver:
300
          1: 9001
301
      enabled: 1
302
      index: control-number
303
      aliases:
304
        - control-number
305
      label: Control-number
306
    copynumber:
307
      bib1_mapping:
308
        biblioserver:
309
          1: 8027
310
      enabled: 1
311
      index: copynumber
312
      aliases:
313
        - copynumber
314
      label: Copynumber
315
    curriculum:
316
      bib1_mapping:
317
        biblioserver:
318
          1: 9658
319
      enabled: 1
320
      index: curriculum
321
      aliases:
322
        - curriculum
323
      label: Curriculum
324
    damaged:
325
      bib1_mapping:
326
        biblioserver:
327
          1: 8005
328
      enabled: 1
329
      index: damaged
330
      aliases:
331
        - damaged
332
      label: Damaged
333
    date-entered-on-file:
334
      bib1_mapping:
335
        biblioserver:
336
          1: date-entered-on-file
337
      enabled: 1
338
      index: date-entered-on-file
339
      aliases:
340
        - date-entered-on-file
341
      label: Date-entered-on-file
342
    datelastborrowed:
343
      bib1_mapping:
344
        biblioserver:
345
          1: 8026
346
      enabled: 1
347
      index: datelastborrowed
348
      aliases:
349
        - datelastborrowed
350
      label: Datelastborrowed
351
    datelastseen:
352
      bib1_mapping:
353
        biblioserver:
354
          1: 8025
355
      enabled: 1
356
      index: datelastseen
357
      aliases:
358
        - datelastseen
359
      label: Datelastseen
360
    dt-bks:
361
      bib1_mapping:
362
        biblioserver:
363
          1: 8700
364
      enabled: 1
365
      index: dt-bks
366
      aliases:
367
        - dt-bks
368
      label: Dt-bks
369
    dt-cf:
370
      bib1_mapping:
371
        biblioserver:
372
          1: 8700
373
      enabled: 1
374
      index: dt-cf
375
      aliases:
376
        - dt-cf
377
      label: Dt-cf
378
    dt-map:
379
      bib1_mapping:
380
        biblioserver:
381
          1: 8700
382
      enabled: 1
383
      index: dt-map
384
      aliases:
385
        - dt-map
386
      label: Dt-map
387
    dt-sr:
388
      bib1_mapping:
389
        biblioserver:
390
          1: 8700
391
      enabled: 1
392
      index: dt-sr
393
      aliases:
394
        - dt-sr
395
      label: Dt-sr
396
    dt-vis:
397
      bib1_mapping:
398
        biblioserver:
399
          1: 8700
400
      enabled: 1
401
      index: dt-vis
402
      aliases:
403
        - dt-vis
404
      label: Dt-vis
405
    ean:
406
      bib1_mapping:
407
        biblioserver:
408
          1: EAN
409
      enabled: 1
410
      index: ean
411
      aliases:
412
        - ean
413
      label: Ean
414
    extent:
415
      bib1_mapping:
416
        biblioserver:
417
          1: Extent
418
      enabled: 1
419
      index: extent
420
      aliases:
421
        - extent
422
      label: Extent
423
    ff8-22:
424
      bib1_mapping:
425
        biblioserver:
426
          1: 8822
427
      enabled: 1
428
      index: ff8-22
429
      aliases:
430
        - ff8-22
431
      label: Ff8-22
432
    ff8-23:
433
      bib1_mapping:
434
        biblioserver:
435
          1: 8823
436
      enabled: 1
437
      index: ff8-23
438
      aliases:
439
        - ff8-23
440
      label: Ff8-23
441
    ff8-34:
442
      bib1_mapping:
443
        biblioserver:
444
          1: 8834
445
      enabled: 1
446
      index: ff8-34
447
      aliases:
448
        - ff8-34
449
      label: Ff8-34
450
    fiction:
451
      bib1_mapping:
452
        biblioserver:
453
          1: 8833
454
      enabled: 1
455
      index: fiction
456
      aliases:
457
        - fiction
458
        - fic
459
      label: Fiction
460
    format:
461
      bib1_mapping:
462
        biblioserver:
463
          1: 8823
464
      enabled: 1
465
      index: format
466
      aliases:
467
        - format
468
      label: Format
469
    graphics-support:
470
      bib1_mapping:
471
        biblioserver:
472
          1: Graphic-support
473
      enabled: 1
474
      index: graphics-support
475
      aliases:
476
        - graphics-support
477
      label: Graphics-support
478
    graphics-type:
479
      bib1_mapping:
480
        biblioserver:
481
          1: Graphic-type
482
      enabled: 1
483
      index: graphics-type
484
      aliases:
485
        - graphics-type
486
      label: Graphics-type
487
    holdingbranch:
488
      bib1_mapping:
489
        biblioserver:
490
          1: 8012
491
      enabled: 1
492
      index: holdingbranch
493
      aliases:
494
        - holdingbranch
495
      label: Holdingbranch
496
    homebranch:
497
      bib1_mapping:
498
        biblioserver:
499
          1: homebranch
500
      enabled: 1
501
      index: homebranch
502
      aliases:
503
        - homebranch
504
        - branch
505
      label: Homebranch
506
    host-item:
507
      bib1_mapping:
508
        biblioserver:
509
          1: 1033
510
      enabled: 1
511
      index: host-item
512
      aliases:
513
        - host-item
514
      label: Host-item
515
    host-item-number:
516
      bib1_mapping:
517
        biblioserver:
518
          1: 8911
519
      enabled: 1
520
      index: host-item-number
521
      aliases:
522
        - host-item-number
523
        - hi
524
      label: Host-item-number
525
    id-other:
526
      bib1_mapping:
527
        biblioserver:
528
          1: 9012
529
      enabled: 1
530
      index: id-other
531
      aliases:
532
        - id-other
533
      label: Id-other
534
    identifier-standard:
535
      bib1_mapping:
536
        biblioserver:
537
          1: 1007
538
      enabled: 1
539
      index: identifier-standard
540
      aliases:
541
        - identifier-standard
542
        - ident
543
      label: Identifier-standard
544
    illustration-code:
545
      bib1_mapping:
546
        biblioserver:
547
          1: "Illustration-code "
548
      enabled: 1
549
      index: illustration-code
550
      aliases:
551
        - illustration-code
552
      label: Illustration-code
553
    isbn:
554
      bib1_mapping:
555
        biblioserver:
556
          1: 7
557
      enabled: 1
558
      index: isbn
559
      aliases:
560
        - isbn
561
        - nb
562
      label: Isbn
563
    issn:
564
      bib1_mapping:
565
        biblioserver:
566
          1: 8
567
      enabled: 1
568
      index: issn
569
      aliases:
570
        - issn
571
        - ns
572
      label: Issn
573
    issues:
574
      bib1_mapping:
575
        biblioserver:
576
          1: 8019
577
      enabled: 1
578
      index: issues
579
      aliases:
580
        - issues
581
      label: Issues
582
    item:
583
      bib1_mapping:
584
        biblioserver:
585
          1: 9520
586
      enabled: 1
587
      index: item
588
      aliases:
589
        - item
590
      label: Item
591
    itemnumber:
592
      bib1_mapping:
593
        biblioserver:
594
          1: 8010
595
      enabled: 1
596
      index: itemnumber
597
      aliases:
598
        - itemnumber
599
      label: Itemnumber
600
    itemtype:
601
      bib1_mapping:
602
        biblioserver:
603
          1: 9006
604
      enabled: 1
605
      index: itemtype
606
      aliases:
607
        - itemtype
608
        - mc-itemtype
609
      label: Itemtype
610
    itype:
611
      bib1_mapping:
612
        biblioserver:
613
          1: 8031
614
      enabled: 1
615
      index: itype
616
      aliases:
617
        - itype
618
        - mc-itype
619
      label: Itype
620
    l-format:
621
      bib1_mapping:
622
        biblioserver:
623
          1: 8703
624
      enabled: 1
625
      index: l-format
626
      aliases:
627
        - l-format
628
      label: L-format
629
    language:
630
      bib1_mapping:
631
        biblioserver:
632
          1: 54
633
      enabled: 1
634
      index: language
635
      aliases:
636
        - language
637
        - ln
638
      label: Language
639
    lc-card-number:
640
      bib1_mapping:
641
        biblioserver:
642
          1: 9
643
      enabled: 1
644
      index: lc-card-number
645
      aliases:
646
        - lc-card-number
647
        - lc-card
648
      label: Lc-card-number
649
    lex:
650
      bib1_mapping:
651
        biblioserver:
652
          1: 9903 r=r
653
      enabled: 1
654
      index: lex
655
      aliases:
656
        - lex
657
      label: Lex
658
    literature-code:
659
      bib1_mapping:
660
        biblioserver:
661
          1: Literature-Code
662
      enabled: 1
663
      index: literature-code
664
      aliases:
665
        - literature-code
666
      label: Literature-code
667
    llength:
668
      bib1_mapping:
669
        biblioserver:
670
          1: llength
671
      enabled: 1
672
      index: llength
673
      aliases:
674
        - llength
675
      label: Llength
676
    local-classification:
677
      bib1_mapping:
678
        biblioserver:
679
          1: 8022
680
      enabled: 1
681
      index: local-classification
682
      aliases:
683
        - local-classification
684
        - lcn
685
        - callnum
686
      label: Local-classification
687
    local-number:
688
      bib1_mapping:
689
        biblioserver:
690
          1: 12
691
      enabled: 1
692
      index: local-number
693
      aliases:
694
        - local-number
695
        - sn
696
      label: Local-number
697
    location:
698
      bib1_mapping:
699
        biblioserver:
700
          1: 8013
701
      enabled: 1
702
      index: location
703
      aliases:
704
        - location
705
        - mc-loc
706
      label: Location
707
    lost:
708
      bib1_mapping:
709
        biblioserver:
710
          1: 8002
711
      enabled: 1
712
      index: lost
713
      aliases:
714
        - lost
715
      label: Lost
716
    match:
717
      bib1_mapping:
718
        authorityserver:
719
          1: Match
720
      enabled: 1
721
      index: match
722
      aliases:
723
        - match
724
      label: Match
725
    material-type:
726
      bib1_mapping:
727
        biblioserver:
728
          1: Material-type
729
      enabled: 1
730
      index: material-type
731
      aliases:
732
        - material-type
733
      label: Material-type
734
    materials-specified:
735
      bib1_mapping:
736
        biblioserver:
737
          1: 8004
738
      enabled: 1
739
      index: materials-specified
740
      aliases:
741
        - materials-specified
742
      label: Materials-specified
743
    music:
744
      bib1_mapping:
745
        biblioserver:
746
          1: Music-number
747
      enabled: 1
748
      index: music
749
      aliases:
750
        - music
751
      label: Music
752
    name:
753
      bib1_mapping:
754
        biblioserver:
755
          1: 1002
756
      enabled: 1
757
      index: name
758
      aliases:
759
        - name
760
      label: Name
761
    note:
762
      bib1_mapping:
763
        biblioserver:
764
          1: 63
765
      enabled: 1
766
      index: note
767
      aliases:
768
        - note
769
        - nt
770
      label: Note
771
    notforloan:
772
      bib1_mapping:
773
        biblioserver:
774
          1: 8008
775
          4: 109
776
      enabled: 1
777
      index: notforloan
778
      aliases:
779
        - notforloan
780
      label: Notforloan
781
    onloan:
782
      bib1_mapping:
783
        biblioserver:
784
          1: 8024
785
      enabled: 1
786
      index: onloan
787
      aliases:
788
        - onloan
789
      label: Onloan
790
    personal-name:
791
      bib1_mapping:
792
        biblioserver:
793
          1: Personal-name
794
      enabled: 1
795
      index: personal-name
796
      aliases:
797
        - personal-name
798
        - pn
799
      label: Personal-name
800
    place-publication:
801
      bib1_mapping:
802
        biblioserver:
803
          1: 59
804
      enabled: 1
805
      index: place-publication
806
      aliases:
807
        - place-publication
808
        - pl
809
      label: Place-publication
810
    popularity:
811
      bib1_mapping:
812
        biblioserver:
813
          1: issues
814
      enabled: 1
815
      index: popularity
816
      aliases:
817
        - popularity
818
      label: Popularity
819
    price:
820
      bib1_mapping:
821
        biblioserver:
822
          1: 8017
823
      enabled: 1
824
      index: price
825
      aliases:
826
        - price
827
      label: Price
828
    publisher:
829
      bib1_mapping:
830
        biblioserver:
831
          1: 1018
832
      enabled: 1
833
      index: publisher
834
      aliases:
835
        - publisher
836
        - pb
837
      label: Publisher
838
    record-control-number:
839
      bib1_mapping:
840
        biblioserver:
841
          1: 1045
842
      enabled: 1
843
      index: record-control-number
844
      aliases:
845
        - record-control-number
846
        - rcn
847
      label: Record-control-number
848
    record-type:
849
      bib1_mapping:
850
        biblioserver:
851
          1: 1001
852
      enabled: 1
853
      index: record-type
854
      aliases:
855
        - record-type
856
        - rtype
857
        - mc-rtype
858
        - mus
859
      label: Record-type
860
    regularity-code:
861
      bib1_mapping:
862
        biblioserver:
863
          1: Regularity-code
864
      enabled: 1
865
      index: regularity-code
866
      aliases:
867
        - regularity-code
868
      label: Regularity-code
869
    renewals:
870
      bib1_mapping:
871
        biblioserver:
872
          1: 8020
873
      enabled: 1
874
      index: renewals
875
      aliases:
876
        - renewals
877
      label: Renewals
878
    replacementprice:
879
      bib1_mapping:
880
        biblioserver:
881
          1: 8029
882
      enabled: 1
883
      index: replacementprice
884
      aliases:
885
        - replacementprice
886
      label: Replacementprice
887
    replacementpricedate:
888
      bib1_mapping:
889
        biblioserver:
890
          1: 8030
891
      enabled: 1
892
      index: replacementpricedate
893
      aliases:
894
        - replacementpricedate
895
      label: Replacementpricedate
896
    reserves:
897
      bib1_mapping:
898
        biblioserver:
899
          1: 8021
900
      enabled: 1
901
      index: reserves
902
      aliases:
903
        - reserves
904
      label: Reserves
905
    restricted:
906
      bib1_mapping:
907
        biblioserver:
908
          1: 8006
909
      enabled: 1
910
      index: restricted
911
      aliases:
912
        - restricted
913
      label: Restricted
914
    stack:
915
      bib1_mapping:
916
        biblioserver:
917
          1: 8018
918
      enabled: 1
919
      index: stack
920
      aliases:
921
        - stack
922
      label: Stack
923
    stock-number:
924
      bib1_mapping:
925
        biblioserver:
926
          1: 1028
927
      enabled: 1
928
      index: stock-number
929
      aliases:
930
        - stock-number
931
      label: Stock-number
932
    stocknumber:
933
      bib1_mapping:
934
        biblioserver:
935
          1: 1062
936
      enabled: 1
937
      index: stocknumber
938
      aliases:
939
        - stocknumber
940
        - inv
941
      label: Stocknumber
942
    summary:
943
      bib1_mapping:
944
        biblioserver:
945
          1: Summary
946
      enabled: 1
947
      index: summary
948
      aliases:
949
        - summary
950
      label: Summary
951
    suppress:
952
      bib1_mapping:
953
        biblioserver:
954
          1: 9011
955
      enabled: 1
956
      index: suppress
957
      aliases:
958
        - suppress
959
      label: Suppress
960
    thesaurus:
961
      bib1_mapping:
962
        authorityserver:
963
          1: Subject-heading-thesaurus
964
      enabled: 1
965
      index: thesaurus
966
      aliases:
967
        - thesaurus
968
      label: Thesaurus
969
    totalissues:
970
      bib1_mapping:
971
        biblioserver:
972
          1: 9003
973
      enabled: 1
974
      index: totalissues
975
      aliases:
976
        - totalissues
977
      label: Totalissues
978
    type-of-serial:
979
      bib1_mapping:
980
        biblioserver:
981
          1: Type-Of-Serial
982
      enabled: 1
983
      index: type-of-serial
984
      aliases:
985
        - type-of-serial
986
      label: Type-of-serial
987
    upc:
988
      bib1_mapping:
989
        biblioserver:
990
          1: UPC
991
      enabled: 1
992
      index: upc
993
      aliases:
994
        - upc
995
      label: Upc
996
    uri:
997
      bib1_mapping:
998
        biblioserver:
999
          1: 8028
1000
      enabled: 1
1001
      index: uri
1002
      aliases:
1003
        - uri
1004
      label: Uri
1005
    video-mt:
1006
      bib1_mapping:
1007
        biblioserver:
1008
          1: Video-mt
1009
      enabled: 1
1010
      index: video-mt
1011
      aliases:
1012
        - video-mt
1013
      label: Video-mt
1014
    withdrawn:
1015
      bib1_mapping:
1016
        biblioserver:
1017
          1: 8001
1018
      enabled: 1
1019
      index: withdrawn
1020
      aliases:
1021
        - withdrawn
1022
      label: Withdrawn
1023
  subject:
1024
    "":
1025
      bib1_mapping:
1026
        authorityserver:
1027
          1: Match-heading
1028
        biblioserver:
1029
          1: 21
1030
      enabled: 1
1031
      index: ''
1032
      label: ''
1033
      aliases:
1034
        - su
1035
        - su-to
1036
        - su-geo
1037
        - su-ut
1038
    authority-number:
1039
      bib1_mapping:
1040
        biblioserver:
1041
          1: Koha-Auth-Number
1042
      enabled: 1
1043
      index: authority-number
1044
      label: Authority-number
1045
      aliases:
1046
        - authority-number
1047
        - an
1048
    complete:
1049
      bib1_mapping:
1050
        biblioserver:
1051
          1: 21
1052
          3: 1
1053
          4: 1
1054
          5: 100
1055
          6: 3
1056
      enabled: 1
1057
      index: complete
1058
      label: Complete
1059
      aliases:
1060
        - complete
1061
    exact:
1062
      bib1_mapping:
1063
        authorityserver:
1064
          4: 1
1065
          5: 100
1066
          6: 3
1067
      enabled: 1
1068
      index: exact
1069
      label: Exact
1070
      aliases:
1071
        - exact
1072
    heading:
1073
      bib1_mapping:
1074
        authorityserver:
1075
          1: Heading
1076
      enabled: 1
1077
      index: heading
1078
      label: Heading
1079
      aliases:
1080
        - heading
1081
        - mainentry
1082
        - he
1083
    headingmain:
1084
      bib1_mapping:
1085
        authorityserver:
1086
          1: Heading-Main
1087
      enabled: 1
1088
      index: headingmain
1089
      label: Headingmain
1090
      aliases:
1091
        - headingmain
1092
        - mainmainentry
1093
    matchheading:
1094
      bib1_mapping:
1095
        authorityserver:
1096
          1: Match-heading
1097
      enabled: 1
1098
      index: matchheading
1099
      label: Matchheading
1100
      aliases:
1101
        - matchheading
1102
        - match-heading
1103
    name-personal:
1104
      bib1_mapping:
1105
        biblioserver:
1106
          1: 1009
1107
      enabled: 1
1108
      index: name-personal
1109
      label: Name-personal
1110
      aliases:
1111
        - name-personal
1112
        - su-na
1113
    seefrom:
1114
      bib1_mapping:
1115
        authorityserver:
1116
          1: Match-heading-see-from
1117
      enabled: 1
1118
      index: seefrom
1119
      label: Seefrom
1120
      aliases:
1121
        - seefrom
1122
        - see-from
1123
    start:
1124
      bib1_mapping:
1125
        authorityserver:
1126
          3: 2
1127
          4: 1
1128
          5: 1
1129
      enabled: 1
1130
      index: start
1131
      label: Start
1132
      aliases:
1133
        - start
1134
  title:
1135
    "":
1136
      bib1_mapping:
1137
        biblioserver:
1138
          1: 4
1139
      enabled: 1
1140
      index: ''
1141
      label: ''
1142
      aliases:
1143
        - ti
1144
    cover:
1145
      bib1_mapping:
1146
        biblioserver:
1147
          1: 36
1148
      enabled: 1
1149
      index: cover
1150
      label: Cover
1151
      aliases:
1152
        - cover
1153
        - title-cover
1154
    exacttitle:
1155
      bib1_mapping:
1156
        biblioserver:
1157
          1: 4
1158
          4: 1
1159
          6: 3
1160
      enabled: 1
1161
      index: exacttitle
1162
      label: Exacttitle
1163
      aliases:
1164
        - exacttitle
1165
        - ti,ext
1166
    series:
1167
      bib1_mapping:
1168
        biblioserver:
1169
          1: 5
1170
      enabled: 1
1171
      index: series
1172
      label: Series
1173
      aliases:
1174
        - series
1175
        - title-series
1176
        - se
1177
    uniform:
1178
      bib1_mapping:
1179
        biblioserver:
1180
          1: Title-uniform
1181
      enabled: 1
1182
      index: uniform
1183
      label: Uniform
1184
      aliases:
1185
        - uniform
1186
        - title-uniform
1187
filter_mappings:
1188
  acqdate:
1189
    bib1_mapping:
1190
      biblioserver:
1191
        1: Date-of-acquisition
1192
        4: 4
1193
        target_syntax_callback: date_filter_target_callback
1194
    enabled: 1
1195
    label: Acqdate
1196
  copydate:
1197
    bib1_mapping:
1198
      biblioserver:
1199
        1: 30
1200
        4: 4
1201
        target_syntax_callback: date_filter_target_callback
1202
1203
    enabled: 1
1204
    label: Copydate
1205
  pubdate:
1206
    bib1_mapping:
1207
      biblioserver:
1208
        1: pubdate
1209
        4: 4
1210
        target_syntax_callback: date_filter_target_callback
1211
    enabled: 1
1212
    label: Pubdate
1213
modifier_mappings:
1214
  AuthidAsc:
1215
    bib1_mapping:
1216
      authorityserver:
1217
        "": 0
1218
        1: Local-Number
1219
        7: 1
1220
        op: "@or"
1221
    enabled: 1
1222
    label: AuthidAsc
1223
  AuthidDsc:
1224
    bib1_mapping:
1225
      authorityserver:
1226
        "": 0
1227
        1: Local-Number
1228
        7: 2
1229
        op: "@or"
1230
    enabled: 1
1231
    label: AuthidDsc
1232
  HeadingAsc:
1233
    bib1_mapping:
1234
      authorityserver:
1235
        "": 0
1236
        1: Heading
1237
        7: 1
1238
        op: "@or"
1239
    enabled: 1
1240
    label: HeadingAsc
1241
  HeadingDsc:
1242
    bib1_mapping:
1243
      authorityserver:
1244
        "": 0
1245
        1: Heading
1246
        7: 2
1247
        op: "@or"
1248
    enabled: 1
1249
    label: HeadingDsc
1250
  Relevance:
1251
    bib1_mapping:
1252
      authorityserver:
1253
        2: 102
1254
    enabled: 1
1255
    label: Relevance
1256
  acqdate_asc:
1257
    bib1_mapping:
1258
      biblioserver:
1259
        "": 0
1260
        1: 32
1261
        7: 2
1262
        op: "@or"
1263
    enabled: 1
1264
    label: Acqdate_asc
1265
  acqdate_dsc:
1266
    bib1_mapping:
1267
      biblioserver:
1268
        "": 0
1269
        1: 32
1270
        7: 1
1271
        op: "@or"
1272
    enabled: 1
1273
    label: Acqdate_dsc
1274
  ascending:
1275
    bib1_mapping:
1276
      biblioserver:
1277
        7: 1
1278
    enabled: 1
1279
    label: Ascending
1280
  author_asc:
1281
    bib1_mapping:
1282
      biblioserver:
1283
        "": 0
1284
        1: 1003
1285
        7: 2
1286
        op: "@or"
1287
    enabled: 1
1288
    label: Author_asc
1289
  author_az:
1290
    bib1_mapping:
1291
      biblioserver:
1292
        "": 0
1293
        1: 1003
1294
        7: 1
1295
        op: "@or"
1296
    enabled: 1
1297
    label: Author_az
1298
  author_dsc:
1299
    bib1_mapping:
1300
      biblioserver:
1301
        "": 0
1302
        1: 1003
1303
        7: 1
1304
        op: "@or"
1305
    enabled: 1
1306
    label: Author_dsc
1307
  author_za:
1308
    bib1_mapping:
1309
      biblioserver:
1310
        "": 0
1311
        1: 1003
1312
        7: 2
1313
        op: "@or"
1314
    enabled: 1
1315
    label: Author_za
1316
  call_number_asc:
1317
    bib1_mapping:
1318
      biblioserver:
1319
        "": 0
1320
        1: 8007
1321
        7: 2
1322
        op: "@or"
1323
    enabled: 1
1324
    label: Call_number_asc
1325
  call_number_dsc:
1326
    bib1_mapping:
1327
      biblioserver:
1328
        "": 0
1329
        1: 8007
1330
        7: 1
1331
        op: "@or"
1332
    enabled: 1
1333
    label: Call_number_dsc
1334
  descending:
1335
    bib1_mapping:
1336
      biblioserver:
1337
        7: 2
1338
    enabled: 1
1339
    label: Descending
1340
  popularity_asc:
1341
    bib1_mapping:
1342
      biblioserver:
1343
        "": 0
1344
        1: 9003
1345
        7: 2
1346
        op: "@or"
1347
    enabled: 1
1348
    label: Popularity_asc
1349
  popularity_dsc:
1350
    bib1_mapping:
1351
      biblioserver:
1352
        "": 0
1353
        1: 9003
1354
        7: 1
1355
        op: "@or"
1356
    enabled: 1
1357
    label: Popularity_dsc
1358
  pubdate_asc:
1359
    bib1_mapping:
1360
      biblioserver:
1361
        "": 0
1362
        1: 31
1363
        7: 2
1364
        op: "@or"
1365
    enabled: 1
1366
    label: Pubdate_asc
1367
  pubdate_dsc:
1368
    bib1_mapping:
1369
      biblioserver:
1370
        "": 0
1371
        1: 31
1372
        7: 1
1373
        op: "@or"
1374
    enabled: 1
1375
    label: Pubdate_dsc
1376
  relevance:
1377
    bib1_mapping:
1378
      biblioserver:
1379
        2: 102
1380
    enabled: 1
1381
    label: Relevance
1382
  relevance_dsc:
1383
    bib1_mapping:
1384
      biblioserver:
1385
        2: 102
1386
    enabled: 1
1387
    label: Relevance_dsc
1388
  title-sort-az:
1389
    bib1_mapping:
1390
      biblioserver:
1391
        "": 0
1392
        1: 36
1393
        7: 1
1394
        op: "@or"
1395
    enabled: 1
1396
    label: Title-sort-az
1397
  title-sort-za:
1398
    bib1_mapping:
1399
      biblioserver:
1400
        "": 0
1401
        1: 36
1402
        7: 2
1403
        op: "@or"
1404
    enabled: 1
1405
    label: Title-sort-za
1406
  title_asc:
1407
    bib1_mapping:
1408
      biblioserver:
1409
        "": 0
1410
        1: 4
1411
        7: 1
1412
        op: "@or"
1413
    enabled: 1
1414
    label: Title_asc
1415
  title_az:
1416
    bib1_mapping:
1417
      biblioserver:
1418
        "": 0
1419
        1: 4
1420
        7: 1
1421
        op: "@or"
1422
    enabled: 1
1423
    label: Title_az
1424
  title_dsc:
1425
    bib1_mapping:
1426
      biblioserver:
1427
        "": 0
1428
        1: 4
1429
        7: 2
1430
        op: "@or"
1431
    enabled: 1
1432
    label: Title_dsc
1433
  title_za:
1434
    bib1_mapping:
1435
      biblioserver:
1436
        "": 0
1437
        1: 4
1438
        7: 2
1439
        op: "@or"
1440
    enabled: 1
1441
    label: Title_za
1442
relevance_bumps: {}

Return to bug 9239