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 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 |
'ln' => 'language', |
522 |
'callnum' => 'callnum', |
526 |
'Record-type' => 'rtype', |
523 |
'itype' => 'itype', |
527 |
'mc-rtype' => 'rtype', |
524 |
'ln' => 'ln', |
528 |
'mus' => 'rtype', |
525 |
'branch' => 'homebranch', |
529 |
'ctype' => 'Content-type', |
526 |
'fic' => 'lf', |
530 |
'lc-card' => 'LC-card-number', |
527 |
'mus' => 'rtype', |
531 |
'sn' => 'Local-number', |
528 |
'aud' => 'ta', |
532 |
'yr' => 'Date-of-publication', |
529 |
'hi' => 'Host-Item-Number', |
533 |
'pubdate' => 'Date-of-publication', |
|
|
534 |
'acqdate' => 'Date-of-acquisition', |
535 |
'Date-time-last-modified' => 'Date/time-last-modified', |
536 |
'dtlm' => 'Date/time-last-modified', |
537 |
'diss' => 'Dissertation-information', |
538 |
'ean' => 'EAN', |
539 |
'nb' => 'ISBN', |
540 |
'isbn' => 'ISBN', |
541 |
'ns' => 'ISSN', |
542 |
'issn' => 'ISSN', |
543 |
'Music-number' => 'Identifier-publisher-for-music', |
544 |
'Number-music-publisher' => 'Identifier-publisher-for-music', |
545 |
'music' => 'Identifier-publisher-for-music', |
546 |
'ident' => 'Identifier-standard', |
547 |
'name' => 'Name', |
548 |
'cpn' => 'Corporate-name', |
549 |
'cfn' => 'Conference-name', |
550 |
'pl' => 'Place-publication', |
551 |
'pn' => 'Personal-name', |
552 |
'pb' => 'Publisher', |
553 |
'pv' => 'Provider', |
554 |
'nt' => 'Note', |
555 |
'notes' => 'Note', |
556 |
'rcn' => 'Record-control-number', |
557 |
'su' => 'Subject', |
558 |
'su-to' => 'Subject', |
559 |
#'su-geo' => 'Subject', |
560 |
'su-ut' => 'Subject', |
561 |
'ti' => 'Title', |
562 |
'se' => 'Title-series', |
563 |
'ut' => 'Title-uniform', |
564 |
'an' => 'Authority-Number', |
565 |
'Koha-Auth-Number' => 'Authority-Number', |
566 |
'at' => 'authtype', |
567 |
'he' => 'Heading', |
568 |
'rank' => 'relevance', |
569 |
'phr' => 'st-phrase', |
570 |
'wrdl' => 'st-word-list', |
571 |
'rt' => 'right-Truncation', |
572 |
'rtrn' => 'right-Truncation', |
573 |
'ltrn' => 'left-Truncation', |
574 |
'rltrn' => 'left-and-right', |
575 |
'mc-itemtype' => 'itemtype', |
576 |
'mc-ccode' => 'ccode', |
577 |
'branch' => 'homebranch', |
578 |
'mc-loc' => 'location', |
579 |
'stocknumber' => 'Number-local-acquisition', |
580 |
'inv' => 'Number-local-acquisition', |
581 |
'bc' => 'barcode', |
582 |
'mc-itype' => 'itype', |
583 |
'aub' => 'Author-personal-bibliography', |
584 |
'auo' => 'Author-in-order', |
585 |
'ff8-22' => 'ta', |
586 |
'aud' => 'ta', |
587 |
'audience' => 'ta', |
588 |
'Frequency-code' => 'ff8-18', |
589 |
'Illustration-code' => 'ff8-18-21', |
590 |
'Regularity-code' => 'ff8-19', |
591 |
'Type-Of-Serial' => 'ff8-21', |
592 |
'format' => 'ff8-23', |
593 |
'Conference-code' => 'ff8-29', |
594 |
'Festschrift-indicator' => 'ff8-30', |
595 |
'Index-indicator' => 'ff8-31', |
596 |
'fiction' => 'lf', |
597 |
'fic' => 'lf', |
598 |
'Literature-Code' => 'lf', |
599 |
'biography' => 'bio', |
600 |
'ff8-34' => 'bio', |
601 |
'Biography-Code' => 'bio', |
602 |
'l-format' => 'ff7-01-02', |
603 |
'lex' => 'lexile-number', |
604 |
'video-mt' => 'Video-mt', |
605 |
'Graphic-type' => 'Graphics-type', |
606 |
'Graphic-support' => 'Graphics-support', |
607 |
'item' => 'Item', |
608 |
'hi' => 'Host-Item-Number', |
609 |
'itu' => 'Index-term-uncontrolled', |
610 |
'itg' => 'Index-term-genre', |
530 |
); |
611 |
); |
531 |
|
612 |
|
532 |
sub _convert_index_fields { |
613 |
sub _convert_index_fields { |
Lines 547-553
sub _convert_index_fields {
Link Here
|
547 |
$f =~ s/^mc-//; |
628 |
$f =~ s/^mc-//; |
548 |
} |
629 |
} |
549 |
my $r = { |
630 |
my $r = { |
550 |
field => $index_field_convert{$f}, |
631 |
field => exists $index_field_convert{$f} ? $index_field_convert{$f} : $f, |
551 |
type => $index_type_convert{ $t // '__default' } |
632 |
type => $index_type_convert{ $t // '__default' } |
552 |
}; |
633 |
}; |
553 |
$r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; |
634 |
$r->{field} = ($mc . $r->{field}) if $mc && $r->{field}; |