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

(-)a/C4/Languages.pm (+14 lines)
Lines 612-617 sub getlanguage { Link Here
612
    return $language;
612
    return $language;
613
}
613
}
614
614
615
=head2 get_rfc4646_from_iso639
616
617
    Select a language rfc4646 code given an iso639 code
618
619
=cut
620
621
sub get_rfc4646_from_iso639 {
622
623
    my $iso_code = shift;
624
    my $rfc_subtag = Koha::Database->new()->schema->resultset('LanguageRfc4646ToIso639')->find({iso639_2_code=>$iso_code})->rfc4646_subtag;
625
    return $rfc_subtag;
626
627
}
628
615
1;
629
1;
616
630
617
__END__
631
__END__
(-)a/Koha/SearchEngine/Elasticsearch.pm (-2 / +1 lines)
Lines 486-492 sub process_error { Link Here
486
    return "Unable to perform your search. Please try again.\n";
486
    return "Unable to perform your search. Please try again.\n";
487
}
487
}
488
488
489
<<<<<<< HEAD
490
=head2 _read_configuration
489
=head2 _read_configuration
491
490
492
    my $conf = _read_configuration();
491
    my $conf = _read_configuration();
Lines 550-556 sub get_facetable_fields { Link Here
550
549
551
    # These should correspond to the ES field names, as opposed to the CCL
550
    # These should correspond to the ES field names, as opposed to the CCL
552
    # things that zebra uses.
551
    # things that zebra uses.
553
    my @search_field_names = qw( author itype location su-geo se subject ccode holdingbranch homebranch );
552
    my @search_field_names = qw( author itype location su-geo se subject ccode holdingbranch homebranch ln);
554
    my @faceted_fields = Koha::SearchFields->search(
553
    my @faceted_fields = Koha::SearchFields->search(
555
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
554
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
556
    );
555
    );
(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (+1 lines)
Lines 119-124 sub build_query { Link Here
119
        'su-geo' => { terms => { field => "su-geo__facet" } },
119
        'su-geo' => { terms => { field => "su-geo__facet" } },
120
        se       => { terms => { field => "se__facet" } },
120
        se       => { terms => { field => "se__facet" } },
121
        ccode    => { terms => { field => "ccode__facet" } },
121
        ccode    => { terms => { field => "ccode__facet" } },
122
        ln       => { terms => { field => "ln__facet" } },
122
    };
123
    };
123
124
124
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
125
    my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (+1 lines)
Lines 434-439 sub _convert_facets { Link Here
434
        ccode         => 'CollectionCodes',
434
        ccode         => 'CollectionCodes',
435
        holdingbranch => 'HoldingLibrary',
435
        holdingbranch => 'HoldingLibrary',
436
        homebranch    => 'HomeLibrary',
436
        homebranch    => 'HomeLibrary',
437
        ln            => 'Language',
437
    );
438
    );
438
    my @facetable_fields =
439
    my @facetable_fields =
439
      Koha::SearchEngine::Elasticsearch->get_facetable_fields;
440
      Koha::SearchEngine::Elasticsearch->get_facetable_fields;
(-)a/admin/searchengine/elasticsearch/mappings.yaml (-3 / +4 lines)
Lines 1720-1741 biblios: Link Here
1720
  ln:
1720
  ln:
1721
    label: ln
1721
    label: ln
1722
    mappings:
1722
    mappings:
1723
      - facet: ''
1723
      - facet: '1'
1724
        marc_field: 008_/35-37
1724
        marc_field: 008_/35-37
1725
        marc_type: marc21
1725
        marc_type: marc21
1726
        sort: ~
1726
        sort: ~
1727
        suggestible: ''
1727
        suggestible: ''
1728
      - facet: ''
1728
      - facet: '1'
1729
        marc_field: 008_/35-37
1729
        marc_field: 008_/35-37
1730
        marc_type: normarc
1730
        marc_type: normarc
1731
        sort: ~
1731
        sort: ~
1732
        suggestible: ''
1732
        suggestible: ''
1733
      - facet: ''
1733
      - facet: '1'
1734
        marc_field: 101a
1734
        marc_field: 101a
1735
        marc_type: unimarc
1735
        marc_type: unimarc
1736
        sort: ~
1736
        sort: ~
1737
        suggestible: ''
1737
        suggestible: ''
1738
    type: ''
1738
    type: ''
1739
    facet_order: 10
1739
  local-classification:
1740
  local-classification:
1740
    label: local-classification
1741
    label: local-classification
1741
    mappings:
1742
    mappings:
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (-1 / +4 lines)
Lines 1-4 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Languages %]
2
[% IF ( opacfacets ) %]
3
[% IF ( opacfacets ) %]
3
[% IF ( facets_loop ) %]
4
[% IF ( facets_loop ) %]
4
<div id="search-facets">
5
<div id="search-facets">
Lines 21-27 Link Here
21
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
22
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
22
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
23
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
23
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
24
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
24
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-locations">Collections</span>[% END %]
25
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-collections">Collections</span>[% END %]
26
[% IF facets_loo.type_label_Language %]<span id="facet-languages">Languages</span>[% END %]
25
<ul>
27
<ul>
26
  [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
28
  [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
27
  [% IF ( sort_by ) %]
29
  [% IF ( sort_by ) %]
Lines 29-34 Link Here
29
  [% END %]
31
  [% END %]
30
  [% FOREACH facet IN facets_loo.facets %]
32
  [% FOREACH facet IN facets_loo.facets %]
31
  [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,0) || facet.facet_label_value %][% END %]
33
  [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,0) || facet.facet_label_value %][% END %]
34
  [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
32
    <li>
35
    <li>
33
      [% IF facet.active %]
36
      [% IF facet.active %]
34
        [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
37
        [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt (+1 lines)
Lines 320-325 a.add, a.delete { Link Here
320
                                                [% CASE 'ccode' %]Collections
320
                                                [% CASE 'ccode' %]Collections
321
                                                [% CASE 'holdingbranch' %]Holding libraries
321
                                                [% CASE 'holdingbranch' %]Holding libraries
322
                                                [% CASE 'homebranch' %]Home libraries
322
                                                [% CASE 'homebranch' %]Home libraries
323
                                                [% CASE 'ln' %]Language
323
                                                [% CASE %][% f %]
324
                                                [% CASE %][% f %]
324
                                                [% END %]
325
                                                [% END %]
325
                                            </td>
326
                                            </td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc (-1 / +4 lines)
Lines 1-4 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Languages %]
2
[% IF ( opacfacets && facets_loop && total ) %]
3
[% IF ( opacfacets && facets_loop && total ) %]
3
    <div id="search-facets">
4
    <div id="search-facets">
4
        <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
5
        <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
Lines 25-31 Link Here
25
                        [% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %]
26
                        [% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %]
26
                        [% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %]
27
                        [% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %]
27
                        [% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %]
28
                        [% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %]
28
                        [% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-itemtypes">Collections</h5>[% END %]
29
                        [% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-collections">Collections</h5>[% END %]
30
                        [% IF facets_loo.type_label_Language %]<h5 id="facet-languages">Languages</h5>[% END %]
29
                        [% UNLESS singleBranchMode %]
31
                        [% UNLESS singleBranchMode %]
30
                            [% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
32
                            [% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
31
                            [% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
33
                            [% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
Lines 38-43 Link Here
38
                            [% END %]
40
                            [% END %]
39
                            [% FOREACH facet IN facets_loo.facets %]
41
                            [% FOREACH facet IN facets_loo.facets %]
40
                            [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,1) || facet.facet_label_value %][% END %]
42
                            [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetByCode('CCODE',facet.facet_label_value,1) || facet.facet_label_value %][% END %]
43
                            [% IF facets_loo.type_label_Language %][% SET facet.facet_label_value = Languages.GetByISOCode(lang,facet.facet_label_value) || facet.facet_label_value %][% END %]
41
                                <li>
44
                                <li>
42
                                  [% IF facet.active %]
45
                                  [% IF facet.active %]
43
                                    [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
46
                                    [% SET local_url = url _ "&amp;nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %]
(-)a/t/db_dependent/Languages.t (-2 / +7 lines)
Lines 6-12 Link Here
6
use strict;
6
use strict;
7
use warnings;
7
use warnings;
8
8
9
use Test::More tests => 17;
9
use Test::More tests => 18;
10
use List::Util qw(first);
10
use List::Util qw(first);
11
use Data::Dumper;
11
use Data::Dumper;
12
use Test::Warn;
12
use Test::Warn;
Lines 95-98 my $LangRfc4646 = $sth->fetchall_arrayref({}); Link Here
95
95
96
is(scalar(@$LangRfc4646),scalar(@$DistinctLangRfc4646),"No unexpected language_rfc4646_to_iso639 duplicates.");
96
is(scalar(@$LangRfc4646),scalar(@$DistinctLangRfc4646),"No unexpected language_rfc4646_to_iso639 duplicates.");
97
97
98
my $i = 0;
99
foreach my $pair (@$DistinctLangRfc4646){
100
    $i++ if $pair->{rfc4646_subtag} eq C4::Languages::get_rfc4646_from_iso639( $pair->{iso639_2_code} );
101
}
102
is($i,scalar(@$DistinctLangRfc4646),"get_rfc4646_from_iso639 returns correct rfc for all iso values.");
103
98
$dbh->rollback;
104
$dbh->rollback;
99
- 

Return to bug 18213