Lines 112-124
sub build_query {
Link Here
|
112 |
# See _convert_facets in Search.pm for how these get turned into |
112 |
# See _convert_facets in Search.pm for how these get turned into |
113 |
# things that Koha can use. |
113 |
# things that Koha can use. |
114 |
$res->{aggregations} = { |
114 |
$res->{aggregations} = { |
115 |
author => { terms => { field => "author__facet" } }, |
115 |
Author => { terms => { field => "Author__facet" } }, |
116 |
subject => { terms => { field => "subject__facet" } }, |
116 |
Subject => { terms => { field => "Subject__facet" } }, |
117 |
itype => { terms => { field => "itype__facet" } }, |
117 |
itype => { terms => { field => "itype__facet" } }, |
118 |
location => { terms => { field => "location__facet" } }, |
118 |
location => { terms => { field => "location__facet" } }, |
119 |
'su-geo' => { terms => { field => "su-geo__facet" } }, |
119 |
'su-geo' => { terms => { field => "su-geo__facet" } }, |
120 |
se => { terms => { field => "se__facet" } }, |
120 |
'Title-series' => { terms => { field => "Title-series__facet" } }, |
121 |
ccode => { terms => { field => "ccode__facet" } }, |
121 |
ccode => { terms => { field => "ccode__facet" } }, |
122 |
}; |
122 |
}; |
123 |
|
123 |
|
124 |
my $display_library_facets = C4::Context->preference('DisplayLibraryFacets'); |
124 |
my $display_library_facets = C4::Context->preference('DisplayLibraryFacets'); |
Lines 204-210
sub build_query_compat {
Link Here
|
204 |
my @sort_params = $self->_convert_sort_fields(@$sort_by); |
204 |
my @sort_params = $self->_convert_sort_fields(@$sort_by); |
205 |
my @index_params = $self->_convert_index_fields(@$indexes); |
205 |
my @index_params = $self->_convert_index_fields(@$indexes); |
206 |
my $limits = $self->_fix_limit_special_cases($orig_limits); |
206 |
my $limits = $self->_fix_limit_special_cases($orig_limits); |
207 |
if ( $params->{suppress} ) { push @$limits, "suppress:0"; } |
207 |
if ( $params->{suppress} ) { push @$limits, "Suppress:0"; } |
208 |
|
208 |
|
209 |
# Merge the indexes in with the search terms and the operands so that |
209 |
# Merge the indexes in with the search terms and the operands so that |
210 |
# each search thing is a handy unit. |
210 |
# each search thing is a handy unit. |
Lines 477-492
sub _convert_sort_fields {
Link Here
|
477 |
|
477 |
|
478 |
# Turn the sorting into something we care about. |
478 |
# Turn the sorting into something we care about. |
479 |
my %sort_field_convert = ( |
479 |
my %sort_field_convert = ( |
480 |
acqdate => 'acqdate', |
480 |
acqdate => 'Date-of-acquisition', |
481 |
author => 'author', |
481 |
author => 'Author', |
482 |
call_number => 'callnum', |
482 |
call_number => 'Local-classification', |
483 |
popularity => 'issues', |
483 |
popularity => 'issues', |
484 |
relevance => undef, # default |
484 |
relevance => undef, # default |
485 |
title => 'title', |
485 |
title => 'Title', |
486 |
pubdate => 'pubdate', |
486 |
pubdate => 'Date-of-publication', |
|
|
487 |
); |
488 |
my %sort_order_convert = ( |
489 |
dsc => 'desc', |
490 |
asc => 'asc', |
491 |
az => 'asc', |
492 |
za => 'desc', |
487 |
); |
493 |
); |
488 |
my %sort_order_convert = |
|
|
489 |
( qw( dsc desc ), qw( asc asc ), qw( az asc ), qw( za desc ) ); |
490 |
|
494 |
|
491 |
# Convert the fields and orders, drop anything we don't know about. |
495 |
# Convert the fields and orders, drop anything we don't know about. |
492 |
grep { $_->{field} } map { |
496 |
grep { $_->{field} } map { |
Lines 513-532
types.
Link Here
|
513 |
=cut |
517 |
=cut |
514 |
|
518 |
|
515 |
our %index_field_convert = ( |
519 |
our %index_field_convert = ( |
516 |
'kw' => '_all', |
520 |
'kw' => '_all', |
517 |
'ti' => 'title', |
521 |
'ab' => 'Abstract', |
518 |
'au' => 'author', |
522 |
'au' => 'Author', |
519 |
'su' => 'subject', |
523 |
'lcn' => 'Local-classification', |
520 |
'nb' => 'isbn', |
524 |
'callnum' => 'Local-classification', |
521 |
'se' => 'title-series', |
525 |
'Record-type' => 'rtype', |
522 |
'callnum' => 'callnum', |
526 |
'mc-rtype' => 'rtype', |
523 |
'itype' => 'itype', |
527 |
'mus' => 'rtype', |
524 |
'ln' => 'ln', |
528 |
'ctype' => 'Content-type', |
525 |
'branch' => 'homebranch', |
529 |
'lc-card' => 'LC-card-number', |
526 |
'fic' => 'lf', |
530 |
'sn' => 'Local-number', |
527 |
'mus' => 'rtype', |
531 |
'yr' => 'Date-of-publication', |
528 |
'aud' => 'ta', |
532 |
'pubdate' => 'Date-of-publication', |
529 |
'hi' => 'Host-Item-Number', |
533 |
'acqdate' => 'Date-of-acquisition', |
|
|
534 |
'Date/time-last-modified' => 'Date-time-last-modified', |
535 |
'dtlm' => 'Date/time-last-modified', |
536 |
'diss' => 'Dissertation-information', |
537 |
'ean' => 'EAN', |
538 |
'nb' => 'ISBN', |
539 |
'isbn' => 'ISBN', |
540 |
'ns' => 'ISSN', |
541 |
'issn' => 'ISSN', |
542 |
'Music-number' => 'Identifier-publisher-for-music', |
543 |
'Number-music-publisher' => 'Identifier-publisher-for-music', |
544 |
'music' => 'Identifier-publisher-for-music', |
545 |
'ident' => 'Identifier-standard', |
546 |
'name' => 'Name', |
547 |
'cpn' => 'Corporate-name', |
548 |
'cfn' => 'Conference-name', |
549 |
'pn' => 'Personal-name', |
550 |
'pb' => 'Publisher', |
551 |
'pv' => 'Provider', |
552 |
'nt' => 'Note', |
553 |
'notes' => 'Note', |
554 |
'rcn' => 'Record-control-number', |
555 |
'su' => 'Subject', |
556 |
'su-to' => 'Subject', |
557 |
#'su-geo' => 'Subject', |
558 |
'su-ut' => 'Subject', |
559 |
'ti' => 'Title', |
560 |
'se' => 'Title-series', |
561 |
'ut' => 'Title-uniform', |
562 |
'an' => 'Authority-Number', |
563 |
'Koha-Auth-Number' => 'Authority-Number', |
564 |
'at' => 'authtype', |
565 |
'he' => 'Heading', |
566 |
'rank' => 'relevance', |
567 |
'phr' => 'st-phrase', |
568 |
'wrdl' => 'st-word-list', |
569 |
'rt' => 'right-Truncation', |
570 |
'rtrn' => 'right-Truncation', |
571 |
'ltrn' => 'left-Truncation', |
572 |
'rltrn' => 'left-and-right', |
573 |
'mc-itemtype' => 'itemtype', |
574 |
'mc-ccode' => 'ccode', |
575 |
'branch' => 'homebranch', |
576 |
'mc-loc' => 'location', |
577 |
'stocknumber' => 'Number-local-acquisition', |
578 |
'inv' => 'Number-local-acquisition', |
579 |
'bc' => 'barcode', |
580 |
'mc-itype' => 'itype', |
581 |
'aub' => 'Author-personal-bibliography', |
582 |
'auo' => 'Author-in-order', |
583 |
'ff8-22' => 'ta', |
584 |
'aud' => 'ta', |
585 |
'audience' => 'ta', |
586 |
'Frequency-code' => 'ff8-18', |
587 |
'Illustration-code' => 'ff8-18-21', |
588 |
'Regularity-code' => 'ff8-19', |
589 |
'Type-Of-Serial' => 'ff8-21', |
590 |
'format' => 'ff8-23', |
591 |
'Conference-code' => 'ff8-29', |
592 |
'Festschrift-indicator' => 'ff8-30', |
593 |
'Index-indicator' => 'ff8-31', |
594 |
'fiction' => 'lf', |
595 |
'fic' => 'lf', |
596 |
'Literature-Code' => 'lf', |
597 |
'biography' => 'bio', |
598 |
'ff8-34' => 'bio', |
599 |
'Biography-Code' => 'bio', |
600 |
'l-format' => 'ff7-01-02', |
601 |
'lex' => 'lexile-number', |
602 |
'video-mt' => 'Video-mt', |
603 |
'Graphic-type' => 'Graphics-type', |
604 |
'Graphic-support' => 'Graphics-support', |
605 |
'item' => 'Item', |
606 |
'hi' => 'Host-Item-Number', |
607 |
'itu' => 'Index-term-uncontrolled', |
608 |
'itg' => 'Index-term-genre', |
530 |
); |
609 |
); |
531 |
|
610 |
|
532 |
sub _convert_index_fields { |
611 |
sub _convert_index_fields { |
Lines 547-553
sub _convert_index_fields {
Link Here
|
547 |
$f =~ s/^mc-//; |
626 |
$f =~ s/^mc-//; |
548 |
} |
627 |
} |
549 |
my $r = { |
628 |
my $r = { |
550 |
field => $index_field_convert{$f}, |
629 |
field => exists $index_field_convert{$f} ? $index_field_convert{$f} : $f, |
551 |
type => $index_type_convert{ $t // '__default' } |
630 |
type => $index_type_convert{ $t // '__default' } |
552 |
}; |
631 |
}; |
553 |
$r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; |
632 |
$r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; |