Sfoglia il codice sorgente

Bug 17169: Add a facet for ccode fields to ElasticSearch

To test:
1 - Apply patch
2 - Backup your db
3 - Drop and create a new db to ensure your mappings are refreshed from
the patch
4 - add some titles with items with collection codes
5 - search and see collection code facets
6 - sign off

Work to be done:
1 - Replace codes with descriptions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
17.05.x
Nick Clemens 5 anni fa
committato da Brendan A Gallagher
parent
commit
306250e496
  1. 1
      Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
  2. 2
      Koha/SearchEngine/Elasticsearch/Search.pm
  3. 9
      admin/searchengine/elasticsearch/mappings.yaml
  4. 1
      koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
  5. 1
      koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc

1
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm

@ -118,6 +118,7 @@ sub build_query {
location => { terms => { field => "location__facet" } },
'su-geo' => { terms => { field => "su-geo__facet" } },
se => { terms => { field => "se__facet" } },
ccode => { terms => { field => "ccode__facet" } },
};
my $display_library_facets = C4::Context->preference('DisplayLibraryFacets');

2
Koha/SearchEngine/Elasticsearch/Search.pm

@ -146,7 +146,6 @@ sub search_compat {
$servers, $results_per_page, $offset, $expanded_facet,
$branches, $query_type, $scan
) = @_;
my %options;
$options{offset} = $offset;
$options{expanded_facet} = $expanded_facet;
@ -408,6 +407,7 @@ sub _convert_facets {
'su-geo' => { order => 4, label => 'Places', },
se => { order => 5, label => 'Series', },
subject => { order => 6, label => 'Topics', },
ccode => { order => 7, label => 'CollectionCodes',},
holdingbranch => { order => 8, label => 'HoldingLibrary' },
homebranch => { order => 9, label => 'HomeLibrary' }
);

9
admin/searchengine/elasticsearch/mappings.yaml

@ -1255,6 +1255,15 @@ biblios:
sort: ~
suggestible: ''
type: ''
ccode:
label: collection-code
mappings:
- facet: '1'
marc_field: '9528'
marc_type: marc21
sort: ~
suggestible: ''
type: ''
control-number:
label: control-number
mappings:

1
koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc

@ -20,6 +20,7 @@
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-locations">Collections</span>[% END %]
<ul>
[% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
[% IF ( sort_by ) %]

1
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc

@ -24,6 +24,7 @@
[% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %]
[% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %]
[% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %]
[% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-itemtypes">Collections</h5>[% END %]
[% UNLESS singleBranchMode %]
[% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %]
[% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %]

Caricamento…
Annulla
Salva